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

C# TestData类代码示例

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

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



TestData类属于命名空间,在下文中一共展示了TestData类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: AddMetadataNode

 private static TestDataNode AddMetadataNode(TestData testData, string metadataType, 
     TestTreeNode rootNode, Node parentNode)
 {
     var testDataNode = new TestDataNode(testData);
     
     var metadataList = testData.Metadata[metadataType];
     if (metadataList.Count > 0)
     {
         foreach (string metadata in metadataList)
         {
             var metadataNode = FindOrAddMetadataNode(metadataType, rootNode, metadata);
             metadataNode.Nodes.Add(testDataNode);
             testDataNode = new TestDataNode(testData); // can't re-use node
         }
     }
     else if (parentNode != null)
     {
         parentNode.Nodes.Add(testDataNode);
     }
     else
     {
         var metadataNode = FindOrAddMetadataNode(metadataType, rootNode, "None");
         metadataNode.Nodes.Add(testDataNode);
     }
     return testDataNode;
 }
开发者ID:dougrathbone,项目名称:mbunit-v3,代码行数:26,代码来源:MetadataTreeBuilder.cs


示例2: VerifyBetInfoInBetslip

        public void VerifyBetInfoInBetslip()
        {
            IWebDriver driver = ((WebDriverBackedSelenium)MyBrowser).UnderlyingWebDriver;
            string EWterms;
            TestData[] testDataLst = new TestData[1];
            testDataLst[0] = new TestData(3, "PreProdEvents");
            Console.WriteLine("***** Executing Test Case --- 'VerifyBetInfoInBetslip', Verify the details on the info frame of the Betslip (user Logged in/Logged out) *****");
            try
            {
                BTcommonObj.WaitForLoadingIcon(MyBrowser, FrameGlobals.IconLoadTimeout);
                BTbetslipObj.OddTypeSwitch(MyBrowser, "decimal");

                // Verify the min/max stake is not displayed in Bet Info if user is logout
                EWterms = BTbetslipObj.AddAndVerifySelectionInBetslip(MyBrowser, "", "Competition", testDataLst[0].ClassName, testDataLst[0].TypeName, testDataLst[0].SubTypeName, testDataLst[0].EventName, testDataLst[0].MarketName, testDataLst[0].SelectionName, testDataLst[0].Odds, true);
                BTbetslipObj.VerifyBetSlip(MyBrowser, testDataLst[0].EventName, testDataLst[0].SelectionName, testDataLst[0].MarketName, testDataLst[0].Odds, EWterms, "Single", 1);

                BTbetslipObj.VerifyBetslipInfo(MyBrowser, testDataLst[0].EventName, testDataLst[0].MarketName, testDataLst[0].SelectionName, testDataLst[0].Odds, EWterms);
                Console.WriteLine("Verification of Bet Info details in Betslip (User Logged Out) was successful");

                // Verify the min/max stake is displayed in the Bet Info on Login
                BTloginLogoutObj.Login(MyBrowser, FrameGlobals.UserName, FrameGlobals.PassWord);
                BTbetslipObj.VerifyBetSlip(MyBrowser, testDataLst[0].EventName, testDataLst[0].SelectionName, testDataLst[0].MarketName, testDataLst[0].Odds, EWterms, "Single", 1);
                BTbetslipObj.VerifyBetslipInfo(MyBrowser, testDataLst[0].EventName, testDataLst[0].MarketName, testDataLst[0].SelectionName, testDataLst[0].Odds, EWterms);
                Console.WriteLine("Verification of Bet Info details in Betslip (User Logged In) was successful");
                Console.WriteLine("TestCase 'VerifyBetInfoInBetslip' - PASS");
            }
            catch (Exception ex)
            {
                CaptureScreenshot(MyBrowser, "VerifyBetInfoInBetslip");
                Console.WriteLine("TestCase 'VerifyBetInfoInBetslip' - FAIL");
                Fail(ex.Message);
            }
        }
开发者ID:hemap,项目名称:PhoenixAutomationRepo,代码行数:33,代码来源:BetslipTests.cs


示例3: CombinedClassAndCollectionFiltersEnabled

		public void CombinedClassAndCollectionFiltersEnabled()
		{
			TestData testData = new TestData(this);
			testData.Prepare();

			ISession session = OpenSession();
			session.EnableFilter("regionlist").SetParameterList("regions", new string[] {"LA", "APAC"});
			session.EnableFilter("fulfilledOrders").SetParameter("asOfDate", testData.lastMonth);

			// test retreival through hql with the collection as non-eager
			IList salespersons = session.CreateQuery("select s from Salesperson as s").List();
			Assert.AreEqual(1, salespersons.Count, "Incorrect salesperson count");
			Salesperson sp = (Salesperson) salespersons[0];
			Assert.AreEqual(1, sp.Orders.Count, "Incorrect order count");

			session.Clear();

			// test retreival through hql with the collection join fetched
			salespersons = session.CreateQuery("select s from Salesperson as s left join fetch s.Orders").List();
			Assert.AreEqual(1, salespersons.Count, "Incorrect salesperson count");
			sp = (Salesperson) salespersons[0];
			Assert.AreEqual(sp.Orders.Count, 1, "Incorrect order count");

			session.Close();
			testData.Release();
		}
开发者ID:NikGovorov,项目名称:nhibernate-core,代码行数:26,代码来源:DynamicFilterTest.cs


示例4: Setup

        public void Setup(TrainingData trainData, TestData testData)
        {
            this.trainData = trainData;
            this.testData = testData;

            uod = DataFormatter.GetUserOrderRepositories(trainData);
        }
开发者ID:AronMiller,项目名称:githubcontest,代码行数:7,代码来源:SimplePearson.cs


示例5: ValidTest1

		public void ValidTest1()
		{
			TestData td1 = new TestData()
			{
				words = new[] { "A" },
				frequency = 6
			};

			TestData td2 = new TestData()
			{
				words = new[] { "B" },
				frequency = 3
			};

			TestData td3 = new TestData()
			{
				words = new[] { "D" },
				frequency = 2
			};

			TestData td4 = new TestData()
			{
				words = new[] { "C" },
				frequency = 1
			};


			TestData[] testSet = new[] { td1, td2, td3, td4 };
			RunTest(testSet, 2, 2);
		}
开发者ID:robbor78,项目名称:samplecode,代码行数:30,代码来源:WordCountTest.cs


示例6: Should_not_register_converters_when_not_asked

        public void Should_not_register_converters_when_not_asked()
        {
            // Given
            var defaultSerializer = new JavaScriptSerializer();

            // When
            var serializer = new JavaScriptSerializer(JsonConfiguration.Default, GlobalizationConfiguration.Default);

            var data =
                new TestData()
                {
                    ConverterData =
                        new TestConverterType()
                        {
                            Data = 42,
                        },

                    PrimitiveConverterData =
                        new TestPrimitiveConverterType()
                        {
                            Data = 1701,
                        },
                };

            const string ExpectedJSON = @"{""converterData"":{""data"":42},""primitiveConverterData"":{""data"":1701}}";

            // Then
            serializer.Serialize(data).ShouldEqual(ExpectedJSON);

            serializer.Deserialize<TestData>(ExpectedJSON).ShouldEqual(data);
        }
开发者ID:uliian,项目名称:Nancy,代码行数:31,代码来源:JavaScriptSerializerFixture.cs


示例7: TestFileDownload

		/// <summary>
		/// Downloads the specified test file and verifies its contents.
		/// </summary>
		private async Task TestFileDownload(TestData.TestFile testFile)
		{
			var target = Path.GetTempFileName();

			try
			{
				Debug.WriteLine("Temporary local file: " + target);

				using (var feedback = new DebugFeedbackChannel("Test"))
				{
					using (var initializing = feedback.BeginSubOperation("InitializeData"))
						await TestData.Current.BringToInitialState(initializing);

					var client = new MegaClient(TestData.Current.Email1, TestData.Current.Password1);
					var filesystem = await client.GetFilesystemSnapshotAsync(feedback);

					var file = testFile.TryFind(filesystem);

					if (file == null)
						Assert.Fail("Could not find expected file to download: " + testFile.Name);

					await file.DownloadContentsAsync(target, feedback);

					using (var expectedContents = testFile.Open())
					using (var contents = File.OpenRead(target))
						TestHelper.AssertStreamsAreEqual(expectedContents, contents);
				}
			}
			finally
			{
				File.Delete(target);
			}
		}
开发者ID:AIBrain,项目名称:mega-client,代码行数:36,代码来源:FileTransferTests.cs


示例8: StoreAsync_WithStorageFile_ThrowsException_IfFileIsNull

        public async Task StoreAsync_WithStorageFile_ThrowsException_IfFileIsNull()
        {
            StorageManager storageManager = new StorageManager();

            TestData data = new TestData() { Text = "Test Text", Number = 42 };
            await AssertEx.ThrowsExceptionAsync<ArgumentNullException>(() => storageManager.StoreAsync(null, data));
        }
开发者ID:shiftkey,项目名称:envelop,代码行数:7,代码来源:StorageManagerFixture.cs


示例9: Create

            public static TestData Create(int stepCount, int machinesPerStep)
            {
                var fixture = new Fixture();
                var returnValue = new TestData
                {
                    DeployBatchRequest = fixture.Build<DeployBatchRequest>()
                                    .With(i=>i.ItemList,
                                            fixture.Build<DeployBatchRequestItem>()
                                                .With(j=>j.MachineList, fixture.CreateMany<DeployMachine>(machinesPerStep).ToList())
                                                .CreateMany(stepCount).ToList())
                                    .Create(),
                    ProjectManager = new Mock<IProjectManager>()
                };
                var deployMachineNameList = fixture.CreateMany("DeployMachineName", machinesPerStep).ToList();
                foreach(var item in returnValue.DeployBatchRequest.ItemList)
                {
                    for(int i = 0; i < machinesPerStep; i++)
                    {
                        item.MachineList[i].MachineName = deployMachineNameList[i];
                    }
                }
                returnValue.Sut = new DeploymentPlanBuilder(returnValue.ProjectManager.Object);

                return returnValue;
            }
开发者ID:gsbastian,项目名称:Sriracha.Deploy,代码行数:25,代码来源:DeploymentPlanBuilderTests.cs


示例10: AddNode

        private static TestTreeNode AddNode(TestData testData, TestTreeNode parent,
            TreeBuilderOptions options)
        {
            var testTreeNode = new TestDataNode(testData);

            if (options.NamespaceHierarchy == NamespaceHierarchy.Flat)
            {
                if (FixtureNode(testData) && parent.TestKind != TestKinds.Namespace)
                {
                    var @namespace = testData.CodeReference.NamespaceName;
                    parent = FindOrAddNamespaceNode(parent, @namespace, @namespace);
                }
                else if (testTreeNode.TestKind == TestKinds.Namespace)
                {
                    return parent;
                }
            }

            if (FixtureNode(testData) && parent.TestKind != TestKinds.Namespace) 
            {
                parent = BuildNamespaceNode(testData, parent, options);
            }
            
            parent.Nodes.Add(testTreeNode);
         
            return testTreeNode;
        }
开发者ID:dougrathbone,项目名称:mbunit-v3,代码行数:27,代码来源:NamespaceTreeBuilder.cs


示例11: CreateTest

        private ObjectModel.TestResult CreateTest(TestData test, TestStepRun stepRun, TestCase testCase)
        {
            ObjectModel.TestResult testResult = new ObjectModel.TestResult(testCase);
            testResult.DisplayName = test.Name;
            testResult.ErrorLineNumber = test.CodeLocation.Line;
            //testResult.ErrorStackTrace
            testResult.StartTime = stepRun.StartTime;
            if (stepRun.TestLog.Streams.Count > 0)
            {
                testResult.ErrorMessage = stepRun.TestLog.Streams[0].ToString();
            }
            testResult.EndTime = stepRun.EndTime;

            testResult.Duration = stepRun.Result.Duration;

            var testStatus = stepRun.Result.Outcome.Status;
            switch (testStatus)
            {
                case TestStatus.Passed:
                    testResult.Outcome = ObjectModel.TestOutcome.Passed;
                    break;
                case TestStatus.Failed:
                    testResult.Outcome = ObjectModel.TestOutcome.Failed;
                    break;
                case TestStatus.Skipped:
                    testResult.Outcome = ObjectModel.TestOutcome.Skipped;
                    break;
                case TestStatus.Inconclusive:
                    testResult.Outcome = ObjectModel.TestOutcome.NotFound;
                    break;
            }

            return testResult;
        }
开发者ID:poobah,项目名称:Gallio-VS2011-Integration,代码行数:34,代码来源:VSTestWindowExtension.cs


示例12: VerifyBetPlacement

        public void VerifyBetPlacement()
        {
            string[] aryOdd = new string[1];
            TestData[] testDataLst = new TestData[1];
            testDataLst[0] = new TestData(0, "PreProdEvents");
            aryOdd[0] = testDataLst[0].Odds;
            Console.WriteLine("***** Executing Test Case --- 'VerifyBetPlacement', Verify Single Bet Placement *****");
            try
            {
                BVTcommonObj.WaitForLoadingIcon(MyBrowser, FrameGlobals.IconLoadTimeout);
                BVTloginLogoutObj.Login(MyBrowser, FrameGlobals.UserName, FrameGlobals.PassWord);
                BVTbetslipObj.OddTypeSwitch(MyBrowser, "decimal");

                BVTbetslipObj.AddAndVerifySelectionInBetslip(MyBrowser, "", "Competition", testDataLst[0].ClassName, testDataLst[0].TypeName, testDataLst[0].SubTypeName, testDataLst[0].EventName, testDataLst[0].MarketName, testDataLst[0].SelectionName, testDataLst[0].Odds, false);
                BVTbetslipObj.VerifyBetSlip(MyBrowser, testDataLst[0].EventName, testDataLst[0].SelectionName, testDataLst[0].MarketName, testDataLst[0].Odds, "", "Single", 1);

                BVTbetslipObj.EnterStake(MyBrowser, testDataLst[0].EventName, testDataLst[0].SelectionName, testDataLst[0].MarketName, testDataLst[0].Odds, testDataLst[0].Stake, "", false);
                BVTbetslipObj.VerifyBetDetails(MyBrowser, testDataLst[0].EventName, testDataLst[0].SelectionName, testDataLst[0].MarketName, aryOdd, testDataLst[0].Stake, "", "Single", "", "");
                BVTbetslipObj.ValidateBetReceipt(MyBrowser, "", testDataLst[0].EventName, testDataLst[0].MarketName, testDataLst[0].SelectionName, aryOdd, testDataLst[0].Stake, "", false, "Single", 1);
                Console.WriteLine("TestCase 'VerifyBetPlacement' - PASS");
            }
            catch (Exception ex)
            {
                CaptureScreenshot(MyBrowser, "VerifyBetPlacement");
                Console.WriteLine("TestCase 'VerifyBetPlacement' - FAIL");
                Fail(ex.Message);
            }
        }
开发者ID:hemap,项目名称:PhoenixAutomationRepo,代码行数:28,代码来源:SanityTests.cs


示例13: EventStatusValidation

        /// <summary>
        /// Method to update and validate event status validations
        /// </summary>
        public void EventStatusValidation(ISelenium browser, ISelenium adminBrowser,TestData testData, string navPanel)
        {
            string eventStatus, updatedStatus;
            string alternateStatus = "Suspended";

            try
            {
                #region Event Status validation

                eventStatus = GetEventStatus(browser, testData.ClassName, navPanel, testData);
                if (eventStatus == "Suspended")
                    alternateStatus = "Active";
                adminCommonObj.UpdateEvents(adminBrowser, testData.CategoryName, testData.ClassName, testData.TypeName, testData.SubTypeName, testData.EventName, alternateStatus);
                Thread.Sleep(FrameGlobals.OpenBetReflectTimeOut);
                Console.WriteLine("Event status is updated in admin");

                updatedStatus = GetEventStatus(browser, testData.ClassName, navPanel, testData);
                Assert.IsFalse(Equals(eventStatus, updatedStatus), "Event status is not updated on the page");

                #endregion

            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
                CaptureScreenshot(browser, "EventStatusValidation");
            }
        }
开发者ID:hemap,项目名称:PhoenixAutomationRepo,代码行数:31,代码来源:HorseRacingFuntions.cs


示例14: Load

    public void Load()
    {
        // No error check for brevity.
        string[] lines = System.IO.File.ReadAllLines(@"userdata.csv");
        for (int index = 0; index < lines.Length; index++)
        {
            string[] record = lines[index].Split(',');
            string name = record[0];
            string email = record[2];
            string id = IndexToId(index);
            idUserMap[id] = new User {
                Name = name,
                Email = email
            };
        }

        var rnd = new Random();
        int numUsers = idUserMap.Count;
        for (int i = 0; i < TEST_SIZE; i++) {
            string fromId = IndexToId(rnd.Next(numUsers));
            string toId = IndexToId(rnd.Next(numUsers));
            TestData data = new TestData {
                FromId = fromId,
                ToId = toId
            };
            testDataList.AddLast(data);
        }
    }
开发者ID:kiidax,项目名称:xlangbench,代码行数:28,代码来源:Bench.cs


示例15: TestComponentAccess

        public unsafe void TestComponentAccess()
        {
            var entity = new Entity();

            entity.AddChild(new Entity("child1")
            {
                new LightComponent()
            });

            var modelComponent = new ModelComponent();

            var compiledUpdate = UpdateEngine.Compile(typeof(Entity), new List<UpdateMemberInfo>
            {
                new UpdateMemberInfo("[ModelComponent.Key]", 0),
                new UpdateMemberInfo("child1[LightComponent.Key].Intensity", 0),
            });

            var testData = new TestData[] { 32.0f };

            fixed (TestData* dataPtr = testData)
            {
                UpdateEngine.Run(entity, compiledUpdate, (IntPtr)dataPtr, new[] { new UpdateObjectData(modelComponent) });
            }

            Assert.That(entity.Get(ModelComponent.Key), Is.EqualTo(modelComponent));
            Assert.That(entity.GetChild(0).Get(LightComponent.Key).Intensity, Is.EqualTo(32.0f));
        }
开发者ID:h78hy78yhoi8j,项目名称:xenko,代码行数:27,代码来源:EntityUpdateEngineTest.cs


示例16: WithDataContractAndRoundedDouble

        public void WithDataContractAndRoundedDouble()
        {
            var data = new TestData
            {
                TestBool = true,
                TestByteArray = new byte[] { 0x00, 0x02, 0x04, 0x05, 0x01 },
                TestDouble = 17.0,
                TestByte = 0xff,
                TestDateTime = new DateTime(2089, 9, 27),
                TestInt = 7,
                TestList = new List<int> { 4, 55, 4, 6, 13 },
                TestLong = 777,
                TestShort = 456,
                TestString = "Hello World!",
                TestChar = 'R',
                TestDecimal = 100,
                TestsByte = 0x05,
                TestuInt = 80,
                DontGo = 42,
                Children = new List<SubTestData> { new SubTestData { Name = "one" }, new SubTestData { Name = "two" } }
            };

            var str = JSON.ToJSON(data);
            var result = JSON.ToObject<TestData>(str);

            VerifyEqual(data, result);
        }
开发者ID:qyezzard,项目名称:PowerJSON,代码行数:27,代码来源:DataContractAttributesTests.cs


示例17: GetExpressionContext

 private static ExpressionContext GetExpressionContext()
 {
     var expressionOwner = new TestData { Id = "World" };
     var context = new ExpressionContext(expressionOwner);
     context.Imports.AddType(typeof(TestDataExtensions));
     return context;
 }
开发者ID:ThomasZitzler,项目名称:flee,代码行数:7,代码来源:ExtensionMethodTest.cs


示例18: CreateFromTest

        public static GallioTestElement CreateFromTest(TestData test, ICodeElementInfo codeElement, IUnitTestProvider provider, 
			GallioTestElement parent)
        {
            if (test == null)
                throw new ArgumentNullException("test");

            // The idea here is to generate a test element object that does not retain any direct
            // references to the code element info and other heavyweight objects.  A test element may
            // survive in memory for quite a long time so we don't want it holding on to all sorts of
            // irrelevant stuff.  Basically we flatten out the test to just those properties that we
            // need to keep.
            var element = new GallioTestElement(provider, parent,
                test.Id,
                test.Name,
                test.Metadata.GetValue(MetadataKeys.TestKind) ?? "Unknown",
                test.IsTestCase,
                ReSharperReflectionPolicy.GetProject(codeElement),
                ReSharperReflectionPolicy.GetDeclaredElementResolver(codeElement),
                GetAssemblyPath(codeElement),
                GetTypeName(codeElement),
                GetNamespaceName(codeElement));

            var categories = test.Metadata[MetadataKeys.Category];
            if (categories.Count != 0)
                element.Categories = UnitTestElementCategory.Create(categories);

            var reason = test.Metadata.GetValue(MetadataKeys.IgnoreReason);
            if (reason != null)
                element.ExplicitReason = reason;

            return element;
        }
开发者ID:dougrathbone,项目名称:mbunit-v3,代码行数:32,代码来源:GallioTestElement6.cs


示例19: GetTestCase

        public TestCase GetTestCase(TestData testData)
        {
            string displayName;

            var fullName = testData.FullName;

            var pos = fullName.LastIndexOf('/');

            if (pos == -1)
            {
                displayName = testData.CodeReference.MemberName;
            }
            else
            {
                displayName = fullName.Substring(pos + 1);
            }

            var testCase = new TestCase(fullName, new Uri(GallioAdapter.ExecutorUri), GetSource(testData))
            {
                CodeFilePath = testData.CodeLocation.Path,
                LineNumber = testData.CodeLocation.Line,
                DisplayName = displayName
            };

            testCase.SetPropertyValue(testIdProperty, testData.Id);

            return testCase;
        }
开发者ID:pawelpabich,项目名称:Gallio-VS2011-Integration,代码行数:28,代码来源:TestCaseFactory.cs


示例20: Should_register_converters_when_asked

        public void Should_register_converters_when_asked()
        {
            // Given
            var defaultSerializer = new JavaScriptSerializer();
            var configuration = new JsonConfiguration(Encoding.UTF8, new[] { new TestConverter() }, new[] { new TestPrimitiveConverter() }, false, false);

            // When
            var serializer = new JavaScriptSerializer(configuration, true, GlobalizationConfiguration.Default);

            var data =
                new TestData()
                {
                    ConverterData =
                        new TestConverterType()
                        {
                            Data = 42,
                        },

                    PrimitiveConverterData =
                        new TestPrimitiveConverterType()
                        {
                            Data = 1701,
                        },
                };

            const string ExpectedJSON = @"{""converterData"":{""dataValue"":42},""primitiveConverterData"":1701}";

            // Then
            serializer.Serialize(data).ShouldEqual(ExpectedJSON);

            serializer.Deserialize<TestData>(ExpectedJSON).ShouldEqual(data);
        }
开发者ID:uliian,项目名称:Nancy,代码行数:32,代码来源:JavaScriptSerializerFixture.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# TestDataConnection类代码示例发布时间:2022-05-24
下一篇:
C# TestControllerBuilder类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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