当前位置: 首页>>代码示例>>C#>>正文


C# UnitTesting.TestContext类代码示例

本文整理汇总了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"));
 }
开发者ID:coapp,项目名称:Test,代码行数:7,代码来源:StringExtensionsTest.cs

示例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;
                }
            }
        }
开发者ID:AnthonyNystrom,项目名称:YoGoMee,代码行数:29,代码来源:When_add_member.cs

示例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);
 }
开发者ID:kbochenina,项目名称:Kraken,代码行数:30,代码来源:SvnStructureFileProcessorTest.cs

示例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));
        }
开发者ID:AnthonyNystrom,项目名称:YoGoMee,代码行数:30,代码来源:When_get_targets_for_gomee.cs

示例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();
		}
开发者ID:ChristopherHaws,项目名称:SpecFlow.SqlBindings,代码行数:7,代码来源:SqlDatabaseSetup.cs

示例6: InitClass

        public static void InitClass(TestContext context)
        {
            dataSource = new TestDataSource();
            ScarfConfiguration.DataSourceFactory = new TestDataSourceFactory(dataSource);

            ScarfConfiguration.ConfigurationSection = ConfigurationMocks.CreateNewScarfSectionMock().Object;
        }
开发者ID:ReBuildAll,项目名称:scarf,代码行数:7,代码来源:ScarfContext_HttpContextTests.cs

示例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);
        }
开发者ID:PSE-2012,项目名称:MMWTV,代码行数:34,代码来源:GreyscaleTest.cs

示例8: AssemblyInit

        public static void AssemblyInit(TestContext context)
        {
            Configuration.Instance.Init();
            Program.Init();

            File.Delete(Configuration.Instance.PrimaryDatabaseName);
        }
开发者ID:ErikHage,项目名称:HabitatTracker,代码行数:7,代码来源:InitializeTests.cs

示例9: Init

 public static void Init(TestContext tctx)
 {
     using (var fs = new FileStream("Config\\AwsS3HandlerParams.json", FileMode.Open))
     {
         _handlerParams = JsonHelper.Load<Config.AwsS3HandlerParams>(fs);
     }
 }
开发者ID:bseddon,项目名称:ACMESharp,代码行数:7,代码来源:AwsS3ProviderTests.cs

示例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";
 }
开发者ID:namoshika,项目名称:SnkLib.Web.GooglePlus,代码行数:7,代码来源:DefaultAccessorTest.cs

示例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);
 }
开发者ID:jonfinerty,项目名称:Spotbox,代码行数:7,代码来源:TestSetup.cs

示例12: MyClassInitialize

        public static void MyClassInitialize(TestContext testContext)
        {
            ObjectFactory.Inject<IEnvironment>(new Environment());
            ObjectFactory.Inject<IDatabaseConnection>(new DatabaseConnection());

            _environment = ObjectFactory.GetInstance<IEnvironment>();
        }
开发者ID:peterbartels,项目名称:GenForm,代码行数:7,代码来源:EnvironmentServicesShould.cs

示例13: UseCase

 public UseCase(string name, TestContext testContext)
 {
     this.name = name;
     ctx = testContext;
     fileList = new List<string>();
     actions = new List<Action>();
 }
开发者ID:Hill30,项目名称:F--Project-Extender,代码行数:7,代码来源:UseCase.cs

示例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)
            };
        }
开发者ID:Dmdv,项目名称:ThreadingPatterns,代码行数:28,代码来源:FixedThreadPooltests.cs

示例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 }
     };
 }
开发者ID:yuriik83,项目名称:UA-.NET,代码行数:35,代码来源:AggregateUnitTest.cs


注:本文中的Microsoft.VisualStudio.TestTools.UnitTesting.TestContext类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。