Example #1
0
        public void Deserialize_restores_immutable_message_correctly()
        {
            // Arrange
            var    sut        = new JsonMessageSerializer();
            var    message    = fixture.Create <ImmutableMessage>();
            string serialized = sut.Serialize(message);

            TestContext.WriteLine(serialized);

            // Act
            object actual = sut.Deserialize(serialized);

            // Assert
            actual.Should().BeOfType <ImmutableMessage>();
            actual.ShouldBeEquivalentTo(message);
        }
Example #2
0
        public void sut_serializes_DateTimeOffset_property_correctly()
        {
            // Arrange
            var message = new MessageWithDateTimeOffsetProperty
            {
                DateTimeOffsetProp = fixture.Create <DateTimeOffset>()
            };
            var sut = new JsonMessageSerializer();

            // Act
            string value = sut.Serialize(message);

            TestContext.WriteLine(value);
            object actual = sut.Deserialize(value);

            // Assert
            actual.Should().BeOfType <MessageWithDateTimeOffsetProperty>();
            actual.ShouldBeEquivalentTo(message);
        }