예제 #1
0
        public void WhenLeftWithSamePrimitiveTypesThenSerializesOk()
        {
            // Arrange
            var settings = GetSettings();
            EitherStrict <int, int> data = EitherStrict.Left <int, int>(10);

            // Act
            string json = JsonConvert.SerializeObject(data, settings);

            // Assert
            Assert.AreEqual("{\"Left\":10}", json);
        }
예제 #2
0
        public void WhenNestedEitherThenSerializesOkCase2()
        {
            // Arrange
            var settings = GetSettings();
            EitherStrict <EitherStrict <int, int>, int> data = EitherStrict.Left <EitherStrict <int, int>, int>(EitherStrict.Right <int, int>(20));

            // Act
            string json = JsonConvert.SerializeObject(data, settings);

            // Assert
            Assert.AreEqual("{\"Left\":{\"Right\":20}}", json);
        }