Exemplo n.º 1
0
        public void Deserialize_adds_error_object_in_serialization_context_when_failure_result()
        {
            DeserializationTestObject errorObject = new DeserializationTestObject {
                Number = 500, String = "Error message"
            };
            Result <object, DeserializationTestObject> failResult = Result.Fail <object, DeserializationTestObject>(errorObject);
            var serialized = Serialize(failResult);

            Result <object, DeserializationTestObject> result = Deserialize <Result <object, DeserializationTestObject> >(serialized);

            result.Error.Should().BeEquivalentTo(errorObject);
        }
Exemplo n.º 2
0
        public void Deserialize_of_generic_result_adds_object_in_context_when_success_result()
        {
            DeserializationTestObject language = new DeserializationTestObject {
                Number = 232, String = "C#"
            };
            Result <DeserializationTestObject> failResult = Result.Ok(language);
            var serialized = Serialize(failResult);

            Result <DeserializationTestObject> result = Deserialize <Result <DeserializationTestObject> >(serialized);

            result.Value.Should().BeEquivalentTo(language);
        }