public void Given_NullStream_Router_Deserializes_IntoNull()
        {
            // Arrange
            Type objectType = typeof(TestType);

            // Act
            object deserializedObject = GuardianRouter.GetDeserializedStream(null, objectType);

            // Assert
            deserializedObject.Should().BeNull();
        }
        public void Given_EmptyStream_Router_Deserializes_IntoNull()
        {
            // Arrange
            Type         objectType = typeof(TestType);
            MemoryStream stream     = new MemoryStream();

            // Act
            object deserializedObject = GuardianRouter.GetDeserializedStream(stream, objectType);

            // Assert
            deserializedObject.Should().BeNull();
        }
        public void Given_Stream_Router_Deserializes_IntoExpectedType()
        {
            // Arrange
            Type     objectType = typeof(TestType);
            TestType testObject = new TestType()
            {
                ID    = 1,
                Title = "This is a test title"
            };

            string objectJson = JsonConvert.SerializeObject(testObject);

            Byte[]       bytes  = Encoding.UTF8.GetBytes(objectJson);
            MemoryStream stream = new MemoryStream(bytes);

            // Act
            object deserializedObject = GuardianRouter.GetDeserializedStream(stream, objectType);

            // Assert
            deserializedObject.GetType().Should().Be(objectType);
            ((TestType)deserializedObject).ID.Should().Be(testObject.ID);
            ((TestType)deserializedObject).Title.Should().Be(testObject.Title);
        }