forked from microsoft/qsharp-runtime
-
Notifications
You must be signed in to change notification settings - Fork 0
/
TestCase.cs
64 lines (56 loc) · 1.98 KB
/
TestCase.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Xunit.Abstractions;
using Xunit.Sdk;
namespace Microsoft.Quantum.Simulation.XUnit
{
[Serializable]
public class TestCase : XunitTestCase
{
TestOperation testOperation;
[EditorBrowsable(EditorBrowsableState.Never)]
[Obsolete("Called by the de-serializer; should only be called by deriving classes for de-serialization purposes")]
public TestCase() : base()
{
}
public TestCase(IMessageSink messageSink, TestMethodDisplay defaultTestMethodDisplay, ITestMethod testMethod, TestOperation testOperation)
: base(messageSink, defaultTestMethodDisplay, testMethod, new[] { testOperation })
{
this.testOperation = testOperation;
}
protected override string GetDisplayName(IAttributeInfo factAttribute, string displayName)
{
if (testOperation.className == "")
{
return displayName;
}
else
{
return testOperation.testCaseNamePrefix + testOperation.className;
}
}
protected override string GetSkipReason(IAttributeInfo factAttribute)
{
return testOperation.skipReason;
}
#region implementation of IXUnitSerializable interface
public override void Serialize(IXunitSerializationInfo data)
{
data.AddValue("testOperation", testOperation);
base.Serialize(data);
}
public override void Deserialize(IXunitSerializationInfo data)
{
base.Deserialize(data);
testOperation = data.GetValue<TestOperation>("testOperation");
this.TestMethodArguments = new[] { testOperation };
}
#endregion
}
}