Esempio n. 1
0
        public void ShouldConvertJsonToRuntimePlatform_Valid(RuntimePlatform runtimePlatform)
        {
            // Arrange
            var converter = new RuntimePlatformJsonConverter();
            var json      = JsonConvert.SerializeObject(runtimePlatform, converter);

            // Act
            var deserializedRuntimePlatform = JsonConvert.DeserializeObject <RuntimePlatform>(json, converter);

            // Assert
            deserializedRuntimePlatform.Should().NotBeNull();
            deserializedRuntimePlatform.Should().BeOfType(runtimePlatform.GetType());
        }
Esempio n. 2
0
        public void ShouldConvertJsonToRuntimePlatform_Null()
        {
            // Arrange
            RuntimePlatform runtimePlatform = (string)null;

            var converter = new RuntimePlatformJsonConverter();
            var json      = JsonConvert.SerializeObject(runtimePlatform, converter);

            // Act
            var deserializedRuntimePlatform = JsonConvert.DeserializeObject <RuntimePlatform>(json, converter);

            // Assert
            deserializedRuntimePlatform.Should().BeNull();
        }