public static void CanRoundTrip_PublicClass_PublicTestMethod()
        {
            var testCase = TestableTestMethodTestCase.Create <Serialization>("CanRoundTrip_PublicClass_PublicTestMethod");

            var serialized   = XunitSerializationInfo.Serialize(testCase);
            var deserialized = XunitSerializationInfo.Deserialize(typeof(TestableTestMethodTestCase), serialized);

            Assert.NotNull(deserialized);
        }
示例#2
0
        public static void UniqueID_Arguments()
        {
            var value42         = TestableTestMethodTestCase.Create <ClassUnderTest>("TestMethod", new object[] { 42 }).UniqueID;
            var valueHelloWorld = TestableTestMethodTestCase.Create <ClassUnderTest>("TestMethod", new object[] { "Hello, world!" }).UniqueID;
            var valueNull       = TestableTestMethodTestCase.Create <ClassUnderTest>("TestMethod", new object[] { (string)null }).UniqueID;

            Assert.NotEmpty(value42);
            Assert.NotEqual(value42, valueHelloWorld);
            Assert.NotEqual(value42, valueNull);
        }
示例#3
0
        public static void CanRoundTrip_PublicClass_PublicTestMethod()
        {
            var serializer   = new BinaryFormatter();
            var testCase     = TestableTestMethodTestCase.Create <Serialization>("CanRoundTrip_PublicClass_PublicTestMethod");
            var memoryStream = new MemoryStream();

            serializer.Serialize(memoryStream, testCase);
            memoryStream.Position = 0;

            serializer.Deserialize(memoryStream);  // Should not throw
        }
示例#4
0
        public static void CanRoundTrip_PublicClass_PrivateTestMethod()
        {
            var serializer   = new BinaryFormatter();
            var testCase     = TestableTestMethodTestCase.Create <Serialization>("CanRoundTrip_PublicClass_PrivateTestMethod");
            var memoryStream = new MemoryStream();

            serializer.Serialize(memoryStream, testCase);
            memoryStream.Position = 0;

            Assert.DoesNotThrow(() => serializer.Deserialize(memoryStream));
        }
示例#5
0
        public static void UniqueID_NoArguments()
        {
            var value = TestableTestMethodTestCase.Create <ClassUnderTest>("TestMethod").UniqueID;

            Assert.NotEmpty(value);
        }