예제 #1
0
        public void ResolveStringToJson_Method_Resolve_WhenSourceNull_ReturnsNull()
        {
            TestHasJsonDataString input = null;
            var expectedResult          = new JsonSerializationTestObject();
            var objectUnderTest         = new ResolveStringToJson <TestHasJsonDataString, TestHasJsonDataObject>();


            var result = objectUnderTest.Resolve(input, null, null, null);


            Assert.AreEqual(null, result);
        }
예제 #2
0
        public void ResolveJsonToString_Method_Resolve_WhenSourceNull_ReturnsNull()
        {
            TestHasJsonDataObject input = null;
            var expectedResultDataValue = JsonSerializationTestObject.ExpectedSerialization();
            var objectUnderTest         = new ResolveJsonToString <TestHasJsonDataObject, TestHasJsonDataString>();


            var result = objectUnderTest.Resolve(input, null, null, null);


            Assert.AreEqual(null, result);
        }
예제 #3
0
        public void ResolveJsonToString_Method_Resolve_WhenSourceValid_SerializesSourceArgumentObjectToString()
        {
            var input = new TestHasJsonDataObject
            {
                Data = new JsonSerializationTestObject()
            };
            var expectedResultDataValue = JsonSerializationTestObject.ExpectedSerialization();
            var objectUnderTest         = new ResolveJsonToString <TestHasJsonDataObject, TestHasJsonDataString>();


            var result = objectUnderTest.Resolve(input, null, null, null);


            Assert.AreEqual(expectedResultDataValue, result, false);
        }
예제 #4
0
        public void ResolveStringToJson_Method_Resolve_WhenSourceValid_SerializesSourceArgumentStringToObject()
        {
            var input = new TestHasJsonDataString()
            {
                Data = JsonSerializationTestObject.ExpectedSerialization()
            };
            var expectedResult  = new JsonSerializationTestObject();
            var objectUnderTest = new ResolveStringToJson <TestHasJsonDataString, TestHasJsonDataObject>();


            var result = objectUnderTest.Resolve(input, null, null, null);


            Assert.AreEqual(expectedResult.a, ExtractPropertyFromResult(result, "a"));
            Assert.AreEqual(expectedResult.b, ExtractPropertyFromResult(result, "b"));
        }