public void Serialization_Result_Test_Test_Successful_Initialization()
        {
            var originalObject   = "Test";
            var serializedObject = "Serialized Object";

            var SUT = SerializationResult.InitSuccessfulSerialization(originalObject, serializedObject, typeof(string));

            Assert.IsTrue(SUT.FailureException == null);
            Assert.IsTrue(SUT.SerializedValue.Value == serializedObject);
            Assert.IsTrue(SUT.SerializedValue.Type.Equals(originalObject.GetType()));
            Assert.IsTrue(SUT.Success == true);
        }
Example #2
0
        public void Setup()
        {
            _successUnserializableTypehelper = new Mock <IUnserializableTypeHelper>();
            _successUnserializableTypehelper.Setup(x => x.IsUnserializable(It.IsAny <Type>())).Returns(false);

            _failUnserializableTypehelper = new Mock <IUnserializableTypeHelper>();
            _failUnserializableTypehelper.Setup(x => x.IsUnserializable(It.IsAny <Type>())).Returns(true);

            _successSerHelper = new Mock <ISerializationHelper>();
            _successSerHelper.Setup(x => x.Serialize(It.IsAny <object>())).Returns(SerializationResult.InitSuccessfulSerialization(new object(), String.Empty, typeof(object)));

            _failSerHelper = new Mock <ISerializationHelper>();
            _failSerHelper.Setup(x => x.Serialize(It.IsAny <object>())).Returns(SerializationResult.InitFailedSerialization(new object(), new StackOverflowException(), typeof(object)));
        }