示例#1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="XunitSerializationInfo"/> class.
 /// </summary>
 /// <param name="object">The data to copy into the serialization info</param>
 public XunitSerializationInfo(IXunitSerializable @object = null)
 {
     if (@object != null)
     {
         @object.Serialize(this);
     }
 }
示例#2
0
        public static string Serialize(IXunitSerializable serializable)
        {
            var serializer = new BasicSerializer();

            serializable.Serialize(serializer);
            return(serializer.DumpToString(serializable.GetType()));
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="XunitSerializationInfo"/> class.
 /// </summary>
 /// <param name="instance">The data to copy into the serialization info.</param>
 public XunitSerializationInfo(IXunitSerializable instance = null)
 {
     if (instance != null)
     {
         instance.Serialize(this);
     }
 }
示例#4
0
        public static TestSerializationInfo Serialize(IXunitSerializable serializableObject)
        {
            if (serializableObject == null)
            {
                throw new ArgumentNullException(nameof(serializableObject));
            }

            var info = new TestSerializationInfo(serializableObject.GetType());

            serializableObject.Serialize(info);

            return(info);
        }
示例#5
0
        XunitTestCaseRunner Runner(IXunitSerializable testCase)
        {
            switch (testCase)
            {
            case ExecutionErrorTestCase _:
                break;

            case XunitTheoryTestCase @case:
                return(new TheoryTestCaseRunner(@case, @case.DisplayName, @case.SkipReason, _constructorArguments,
                                                _diagnosticMessageSink, MessageBus,
                                                new ExceptionAggregator(Aggregator),
                                                CancellationTokenSource));

            case XunitTestCase @case:
                return(new TestCaseRunner(@case, @case.DisplayName, @case.SkipReason, _constructorArguments,
                                          @case.TestMethodArguments, MessageBus,
                                          new ExceptionAggregator(Aggregator),
                                          CancellationTokenSource));
            }

            return(null);
        }