本文整理汇总了C#中Microsoft.VisualStudio.TestTools.UnitTesting.TestContext类的典型用法代码示例。如果您正苦于以下问题:C# TestContext类的具体用法?C# TestContext怎么用?C# TestContext使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TestContext类属于Microsoft.VisualStudio.TestTools.UnitTesting命名空间,在下文中一共展示了TestContext类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: MyClassInitialize
public static void MyClassInitialize(TestContext testContext)
{
testStrings = new List<string>();
testStrings.AddRange(File.ReadLines("..\\..\\..\\..\\Test\\CoApp\\Toolkit\\Extensions\\TestStrings.txt"));
Files = new List<string>();
Files.AddRange(File.ReadLines("..\\..\\..\\..\\Test\\CoApp\\Toolkit\\Extensions\\FileList.txt"));
}
示例2: SetUp
public static void SetUp(TestContext context)
{
_unitOfWork = new UnitOfWork();
var memberFactory = new MemberFactory();
_email = Guid.NewGuid().ToString();
_decorator = new MemberDecorator(memberFactory, _unitOfWork.MemberRepository);
_oldCount = _unitOfWork.MemberRepository.Count();
_member = memberFactory.CreateMember(_email);
_sameMember = memberFactory.CreateMember(_email);
_decorator.Add(_member);
_unitOfWork.PersistAll();
using (var uow = new UnitOfWork())
{
_newCount = uow.MemberRepository.Count();
try
{
_loadedMember = uow.MemberRepository.Get(_member.Id);
}
catch (Exception)
{
_loadedMember = null;
}
}
}
示例3: MyClassInitialize
public static void MyClassInitialize(TestContext testContext)
{
var structureFileData = "FirstPackage/\n" +
"FirstPackage/Unix/\n" +
"FirstPackage/Unix/tags/\n" +
"FirstPackage/Unix/tags/FirstVersion/\n" +
"FirstPackage/Unix/tags/FirstVersion/metadata.xml\n" +
"FirstPackage/Unix/tags/FirstVersion/testp.zip\n" +
"FirstPackage/Unix/tags/SecondVersion/\n" +
"FirstPackage/Unix/tags/SecondVersion/metadata.xml\n" +
"FirstPackage/Unix/tags/SecondVersion/testp.zip\n" +
"FirstPackage/Unix/trunk/\n" +
"FirstPackage/Unix/trunk/metadata.xml\n" +
"FirstPackage/Unix/trunk/testp.zip\n" +
"FirstPackage/Windows/\n" +
"FirstPackage/Windows/tags/\n" +
"FirstPackage/Windows/tags/ProtoVersion/\n" +
"FirstPackage/Windows/tags/ProtoVersion/metadata.xml\n" +
"FirstPackage/Windows/tags/ProtoVersion/testp.zip\n" +
"FirstPackage/Windows/tags/SecondVersion/\n" +
"FirstPackage/Windows/tags/SecondVersion/metadata.xml\n" +
"FirstPackage/Windows/tags/SecondVersion/testp.zip\n" +
"FirstPackage/Windows/tags/ThirdVersion/\n" +
"FirstPackage/Windows/tags/ThirdVersion/metadata.xml\n" +
"FirstPackage/Windows/tags/ThirdVersion/testp.zip\n" +
"FirstPackage/Windows/trunk/\n" +
"FirstPackage/Windows/trunk/metadata.xml\n" +
"FirstPackage/Windows/trunk/testp.zip\n";
File.WriteAllText(path, structureFileData);
}
示例4: SetUp
public static void SetUp(TestContext context)
{
_unitOfWork = new UnitOfWork();
_memberFactory = new MemberFactory();
_gomeeFactory = new GomeeFactory();
_targetFactory = new TargetFactory();
_targetDecorator = new TargetDecorator(_targetFactory, _unitOfWork.TargetRepository);
_member = _memberFactory.CreateMember(Guid.NewGuid().ToString());
_gomee = _gomeeFactory.CreateGomee(_member);
_targets = new List<Target>();
using (var uow = new UnitOfWork())
{
uow.MemberRepository.Add(_member);
uow.GomeeRepository.Add(_gomee);
var count = new Random().Next(2, 5);
for (var i = 0; i < count; i++)
{
var target = _targetFactory.CreateGomeeTarget(_member, _gomee);
_targets.Add(target);
uow.TargetRepository.Add(target);
}
uow.PersistAll();
}
_loadedTargets = _targetDecorator.GetFor(_unitOfWork.GomeeRepository.Get(_gomee.Id));
}
示例5: InitializeAssembly
public static void InitializeAssembly(TestContext ctx)
{
// Setup the test database based on setting in the
// configuration file
SqlDatabaseTestClass.TestService.DeployDatabaseProject();
SqlDatabaseTestClass.TestService.GenerateData();
}
示例6: InitClass
public static void InitClass(TestContext context)
{
dataSource = new TestDataSource();
ScarfConfiguration.DataSourceFactory = new TestDataSourceFactory(dataSource);
ScarfConfiguration.ConfigurationSection = ConfigurationMocks.CreateNewScarfSectionMock().Object;
}
示例7: MyClassInitialize
public static void MyClassInitialize(TestContext testContext)
{
Greyscale conv = new Greyscale();
testBitmap = new Bitmap(testPixel, testPixel);
for (int height = 0; height < testBitmap.Height; height++)
{
for (int width = 0; width < testBitmap.Width; width++)
{
testBitmap.SetPixel(width, height, Color.White);
width++;
testBitmap.SetPixel(width, height, Color.Black);
width++;
testBitmap.SetPixel(width, height, Color.Red);
width++;
testBitmap.SetPixel(width, height, Color.Green);
width++;
testBitmap.SetPixel(width, height, Color.Blue);
}
}
//create greyscale
double[] newColorValues = new double[3];
for (int i = 0; i < newColorValues.GetLength(0); i++)
{
newColorValues[i] = 1;
}
fullGrey = new Memento("Blur", newColorValues);
//get greyscaled Bitmap
original = conv.getMemento();
conv.setMemento(fullGrey);
processedBitmap = conv.process(testBitmap);
conv.setMemento(original);
}
示例8: AssemblyInit
public static void AssemblyInit(TestContext context)
{
Configuration.Instance.Init();
Program.Init();
File.Delete(Configuration.Instance.PrimaryDatabaseName);
}
示例9: Init
public static void Init(TestContext tctx)
{
using (var fs = new FileStream("Config\\AwsS3HandlerParams.json", FileMode.Open))
{
_handlerParams = JsonHelper.Load<Config.AwsS3HandlerParams>(fs);
}
}
示例10: PlatformClientInitialize
public static void PlatformClientInitialize(TestContext testContext)
{
clientStabA = new PlatformClientStub(new System.Net.CookieContainer());
clientStabA.AtValue = "initDt_AtValue";
clientStabA.EjxValue = "initDt_EjxValue";
clientStabA.PvtValue = "initDt_PvtValue";
}
示例11: StartupSpotSharp
public static void StartupSpotSharp(TestContext context)
{
// Ok, so.. turns out libspotify has issues shutting down/restart in the same process.
// This means in order to test SpotSharp we will start and login to one instance at
// the start of testing.
spotSharp = new SpotSharp.SpotSharp(_spotifyApiKey);
}
示例12: MyClassInitialize
public static void MyClassInitialize(TestContext testContext)
{
ObjectFactory.Inject<IEnvironment>(new Environment());
ObjectFactory.Inject<IDatabaseConnection>(new DatabaseConnection());
_environment = ObjectFactory.GetInstance<IEnvironment>();
}
示例13: UseCase
public UseCase(string name, TestContext testContext)
{
this.name = name;
ctx = testContext;
fileList = new List<string>();
actions = new List<Action>();
}
示例14: MyClassInitialize
public static void MyClassInitialize(TestContext testContext)
{
_tasks = new[]
{
new TestTask(Priority.High),
new TestTask(Priority.High),
new TestTask(Priority.Normal),
new TestTask(Priority.Low)
};
_lowtasks = new[]
{
new TestTask(Priority.Low),
new TestTask(Priority.Low)
};
_normallowtasks = new[]
{
new TestTask(Priority.Low),
new TestTask(Priority.Normal)
};
_highlowtasks = new[]
{
new TestTask(Priority.Low),
new TestTask(Priority.High)
};
}
示例15: MyClassInitialize
public static void MyClassInitialize(TestContext testContext)
{
List<TestData> testData = TestDataSet.LoadFromXMLFile("TestData.xml");
TestData = new Dictionary<string, TestData>();
for (int i = 0; i < testData.Count; i++)
{
TestData.Add(testData[i].Name, testData[i]);
}
AggregateLookup = new Dictionary<AggregateType, NodeId>()
{
{ AggregateType.AnnotationCount, Opc.Ua.ObjectIds.AggregateFunction_AnnotationCount },
{ AggregateType.Average, Opc.Ua.ObjectIds.AggregateFunction_Average },
{ AggregateType.Count, Opc.Ua.ObjectIds.AggregateFunction_Count },
{ AggregateType.Delta, Opc.Ua.ObjectIds.AggregateFunction_Delta },
{ AggregateType.DurationBad, Opc.Ua.ObjectIds.AggregateFunction_DurationBad },
{ AggregateType.DurationGood, Opc.Ua.ObjectIds.AggregateFunction_DurationGood },
{ AggregateType.DurationInState0, Opc.Ua.ObjectIds.AggregateFunction_DurationInStateZero},
{ AggregateType.DurationInState1, Opc.Ua.ObjectIds.AggregateFunction_DurationInStateNonZero},
{ AggregateType.End, Opc.Ua.ObjectIds.AggregateFunction_End },
{ AggregateType.Interpolative, Opc.Ua.ObjectIds.AggregateFunction_Interpolative },
{ AggregateType.Max, Opc.Ua.ObjectIds.AggregateFunction_Maximum },
{ AggregateType.MaxActualTime, Opc.Ua.ObjectIds.AggregateFunction_MaximumActualTime },
{ AggregateType.Min, Opc.Ua.ObjectIds.AggregateFunction_Minimum },
{ AggregateType.MinActualTime, Opc.Ua.ObjectIds.AggregateFunction_MinimumActualTime },
{ AggregateType.NumberOfTransitions, Opc.Ua.ObjectIds.AggregateFunction_NumberOfTransitions },
{ AggregateType.PercentBad, Opc.Ua.ObjectIds.AggregateFunction_PercentBad },
{ AggregateType.PercentGood, Opc.Ua.ObjectIds.AggregateFunction_PercentGood },
{ AggregateType.Range, Opc.Ua.ObjectIds.AggregateFunction_Range },
{ AggregateType.Start, Opc.Ua.ObjectIds.AggregateFunction_Start },
{ AggregateType.TimeAverage, Opc.Ua.ObjectIds.AggregateFunction_TimeAverage },
{ AggregateType.Total, Opc.Ua.ObjectIds.AggregateFunction_Total },
{ AggregateType.TotalizeAverage, Opc.Ua.ObjectIds.AggregateFunction_Total2},
{ AggregateType.WorstQuality, Opc.Ua.ObjectIds.AggregateFunction_WorstQuality }
};
}