本文整理汇总了C#中TestData类的典型用法代码示例。如果您正苦于以下问题:C# TestData类的具体用法?C# TestData怎么用?C# TestData使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TestData类属于命名空间,在下文中一共展示了TestData类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
示例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);
}
}
示例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();
}
示例4: Setup
public void Setup(TrainingData trainData, TestData testData)
{
this.trainData = trainData;
this.testData = testData;
uod = DataFormatter.GetUserOrderRepositories(trainData);
}
示例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);
}
示例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);
}
示例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);
}
}
示例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));
}
示例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;
}
示例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;
}
示例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;
}
示例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);
}
}
示例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");
}
}
示例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);
}
}
示例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));
}