本文整理汇总了C#中TestState类的典型用法代码示例。如果您正苦于以下问题:C# TestState类的具体用法?C# TestState怎么用?C# TestState使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TestState类属于命名空间,在下文中一共展示了TestState类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Expect_that_a_serialized_object_can_be_deserialized_accurately
public void Expect_that_a_serialized_object_can_be_deserialized_accurately()
{
var objIn = new TestState {
A = decimal.MaxValue,
B = "Hello World!",
C = DateTime.MaxValue,
D = long.MaxValue,
E = new byte[] { 1, 2, 3 },
F = true
};
var ms = new MemoryStream(128);
var serializer = new Serializer();
serializer.Serialize(ms, objIn);
ms.Position = 0;
var objOut = serializer.Deserialize<TestState>(ms);
Assert.That(objOut.A == objIn.A);
Assert.That(objOut.B == objIn.B);
Assert.That(objOut.C == objIn.C);
Assert.That(objOut.D == objIn.D);
Assert.That(objOut.E.SequenceEqual(objIn.E));
Assert.That(objOut.F == objIn.F);
}
示例2: TestTreeNode
public TestTreeNode(string name, TestNodeType nodeType)
{
this.name=name;
this.nodeType = nodeType;
this.state = TestState.NotRun;
this.nodes = new TestTreeNodeCollection(this);
}
示例3: ShouldAddComponentToGameState
public void ShouldAddComponentToGameState()
{
var state = new TestState();
Assert.False(state.HasComponent(typeof (FooComponent)));
var comp = state.AddComponent(new FooComponent());
Assert.True(state.HasComponent(comp));
}
示例4: CookiesOnTheRequestAndInTheContainer
public async Task CookiesOnTheRequestAndInTheContainer()
{
// ARRANGE
var ts = new TestState
{
Request =
{
Headers =
{
{"Cookie", "a=1; b=2"},
{"cookie", "c=3; "},
{"COOKIE", "d=4;"},
{"cOOKIE", "e=5"}
}
}
};
ts.CookieContainer.Add(ts.Uri, new Cookie("f", "6"));
ts.CookieContainer.Add(ts.Uri, new Cookie("g", "7"));
// ACT
await ts.HttpClient.SendAsync(ts.Request);
// ASSERT
ts.VerifyRequestCookie("a=1; b=2; c=3; d=4; e=5; f=6; g=7");
}
示例5: It_Reads_One_Chunk_Asynchronously
public async Task It_Reads_One_Chunk_Asynchronously()
{
// ARRANGE
var ts = new TestState();
// ACT, ASSERT
await ts.ReadAndVerifyAsync(ts.MultipleChunks);
}
示例6: It_Reads_Multiple_Chunks_With_A_Large_Buffer_Asynchronously
public async Task It_Reads_Multiple_Chunks_With_A_Large_Buffer_Asynchronously()
{
// ARRANGE
var ts = new TestState { BufferSize = 1024 };
// ACT, ASSERT
await ts.ReadAndVerifyAsync(ts.MultipleChunks);
}
示例7: It_Reads_One_Chunk_Synchronously
public void It_Reads_One_Chunk_Synchronously()
{
// ARRANGE
var ts = new TestState();
// ACT, ASSERT
ts.ReadAndVerify(ts.MultipleChunks);
}
示例8: It_Reads_Multiple_Chunks_With_A_Large_Buffer_Synchronously
public void It_Reads_Multiple_Chunks_With_A_Large_Buffer_Synchronously()
{
// ARRANGE
var ts = new TestState { BufferSize = 1024 };
// ACT, ASSERT
ts.ReadAndVerify(ts.MultipleChunks);
}
示例9: It_Can_Read_All_Lines_With_Trailing_Line_Endings
public async Task It_Can_Read_All_Lines_With_Trailing_Line_Endings()
{
// ARRANGE
var ts = new TestState();
// ACT, ASSERT
await ts.VerifyAllLinesAsync(ts.TrailingLineEndings);
}
示例10: Process
private void Process(string displayName, TestState state, string output = "")
{
Console.WriteLine($"{state} - {displayName}");
var result = new TestResultData(displayName, state, output);
_writer.Write(TestDataKind.Value);
_writer.Write(result);
}
示例11: Fail
public void Fail(Exception exception)
{
if (exception == null)
throw new ArgumentNullException("exception");
this.Stop();
this.state = TestState.Failure;
this.exception = exception;
}
示例12: ShouldHaveComponentOfType
public void ShouldHaveComponentOfType()
{
var state = new TestState();
var fooComp = new FooComponent();
state.AddComponent(fooComp);
Assert.True(state.HasComponent(typeof(FooComponent)));
Assert.False(state.HasComponent(typeof(BarComponent)));
}
示例13: It_Returns_All_Contents_With_A_Large_Buffer
public async Task It_Returns_All_Contents_With_A_Large_Buffer()
{
// ARRANGE
var ts = new TestState();
// ACT, ASSERT
await ts.VerifyReadLineThenReadBytesAsync(ts.TrailingLineEndings, ts.GetLength(ts.TrailingLineEndings) * 2);
}
示例14: ShouldHaveComponentMatchingPredicate
public void ShouldHaveComponentMatchingPredicate()
{
var state = new TestState();
var fooComp = new FooComponent();
state.AddComponent(fooComp);
Assert.True(state.HasComponent(c => ((FooComponent)c).Test == "Foo"));
Assert.False(state.HasComponent(c => ((FooComponent)c).Test == "Bar"));
}
示例15: ShouldOnlyHaveExactReferenceToComponent
public void ShouldOnlyHaveExactReferenceToComponent()
{
var state = new TestState();
var fooComp = new FooComponent();
var fooComp2 = new FooComponent();
state.AddComponent(fooComp);
Assert.True(state.HasComponent(fooComp));
Assert.False(state.HasComponent(fooComp2));
}