• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# UnitTesting.TestContext类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中Microsoft.VisualStudio.TestTools.UnitTesting.TestContext的典型用法代码示例。如果您正苦于以下问题:C# TestContext类的具体用法?C# TestContext怎么用?C# TestContext使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



TestContext类属于Microsoft.VisualStudio.TestTools.UnitTesting命名空间,在下文中一共展示了TestContext类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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


示例16: MyClassInitialize

		public static void MyClassInitialize(TestContext testContext)
		{
			if (!Directory.Exists(Utility.RootFolder))
			{
				Directory.CreateDirectory(Utility.RootFolder);
			}
			if (!Directory.Exists(Utility.TempFolder))
			{
				Directory.CreateDirectory(Utility.TempFolder);
			}
			_mXmlNs = Utility.NS;
			_mOnGenerator = new OneNoteGenerator(Utility.RootFolder);
			//Get Id of the test notebook so we chould retrieve generated content
			//KindercareFormatConverter will create notebookName as Kindercare
			_mNotebookId = _mOnGenerator.CreateNotebook(NotebookName);

			var word = new Application();
			var doc = word.Application.Documents.Add();

			//add pages to doc
			for (int i = 1; i < DocPageTitles.Count; i++)
			{
				doc.Content.Text += DocPageTitles[i];
				doc.Words.Last.InsertBreak(WdBreakType.wdPageBreak);
			}

			var filePath = TestDocPath as object;
            doc.SaveAs(ref filePath);
            ((_WordDocument)doc).Close();
            ((_WordApplication)word).Quit();
		}
开发者ID:OneNoteDev,项目名称:OneNoteConversionTool,代码行数:31,代码来源:GenericFormatConverterUnitTest.cs


示例17: TestClassSetup

 public static void TestClassSetup(TestContext context)
 {
     _configuration = new Configuration();
     _configuration.Configure();
     _configuration.AddAssembly(typeof(Draft).Assembly);
     _sessionFactory = _configuration.BuildSessionFactory();
 }
开发者ID:Snidd,项目名称:RotisserieDraft,代码行数:7,代码来源:TestMemberRepository.cs


示例18: Init

 public static void Init(TestContext x)
 {
     OpenQA.Selenium.Firefox.FirefoxDriver fd = new OpenQA.Selenium.Firefox.FirefoxDriver();
     Browsers.Add(fd);
     OpenQA.Selenium.Chrome.ChromeDriver cd = new OpenQA.Selenium.Chrome.ChromeDriver();
     Browsers.Add(cd);
 }
开发者ID:MHacker9404,项目名称:MSTestLooper,代码行数:7,代码来源:SeleniumTests.cs


示例19: ClassInit

        public static void ClassInit(TestContext context)
        {
            SetTestSettings();

            if (defaultAzureSubscription.Equals(null))
            {
                Assert.Inconclusive("No Subscription is selected!");
            }

            vhdBlobLocation = blobUrlRoot + vhdBlob;
            try
            {
                vmPowershellCmdlets.AddAzureVhd(new FileInfo(localFile), vhdBlobLocation);
            }
            catch (Exception e)
            {
                if (e.ToString().Contains("already exists"))
                {
                    // Use the already uploaded vhd.
                    Console.WriteLine("Using already uploaded blob..");
                }
                else
                {
                    throw;
                }
            }
        }
开发者ID:shanmukrao,项目名称:azure-sdk-tools,代码行数:27,代码来源:SaveAzureVhdTest.cs


示例20: ClassInit

        public static void ClassInit(TestContext context)
        {
            _startingHandCombos = new Dictionary<string, WeightedStartingHandCombo>();
            _startingHandPermutations = new Dictionary<string, WeightedStartingHandCombo>();

            //All starting hands match a regular expression after ToString is called
            List<Card> cards = new List<Card>();
            foreach (Rank r in (Rank[])Enum.GetValues(typeof(Rank)))
            {
                foreach (Suit s in (Suit[])Enum.GetValues(typeof(Suit)))
                {
                    cards.Add(new Card(r, s));
                }
            }

            for (int iFirstCard = 0; iFirstCard < 52; iFirstCard++)
            {
                for (int iSecondCard = iFirstCard + 1; iSecondCard < 52; iSecondCard++)
                {
                    WeightedStartingHandCombo hand = new WeightedStartingHandCombo(cards[iFirstCard], cards[iSecondCard], 1);
                    _startingHandCombos.Add(hand.ToString(false), hand);
                    _startingHandPermutations.Add(hand.ToString(), hand);

                    WeightedStartingHandCombo handOppOrder = new WeightedStartingHandCombo(cards[iSecondCard], cards[iFirstCard], 1);
                    _startingHandPermutations.Add(handOppOrder.ToString(), handOppOrder);
                }
            }

            Assert.IsTrue(_startingHandCombos.Count == (52 * 51) / 2, "Incorrect number of combo's.");
            Assert.IsTrue(_startingHandPermutations.Count == 52 * 51, "Incorrect number of permutations.");
        }
开发者ID:KevinDKoch,项目名称:Poker,代码行数:31,代码来源:StartingHandComboTests.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# VisualStudioTools.VisualStudioApp类代码示例发布时间:2022-05-26
下一篇:
C# UnitTesting.List类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap