Ejemplo n.º 1
0
        public void IgnorePropertiesWithErrors()
        {
            var loggerMock = new Mock<ILogger>();

            ISerializer serializer = new JsonNetSerializer(loggerMock.Object);

            var badObject = new TestObjectWithException();

            string result = serializer.Serialize(badObject);

            Assert.Equal("{\"string\":\"A string\"}", result);
            //This verify is not registered due to lambda. It has been verified to work
            //loggerMock.Verify(l=>l.Error(It.IsAny<string>(), It.IsAny<NotSupportedException>()));
        }
Ejemplo n.º 2
0
        public void IgnorePropertiesWithErrors()
        {
            var loggerMock = new Mock <ILogger>();

            ISerializer serializer = new JsonNetSerializer(loggerMock.Object);

            var badObject = new TestObjectWithException();

            string result = serializer.Serialize(badObject);

            Assert.Equal("{\"string\":\"A string\"}", result);
            //This verify is not registered due to lambda. It has been verified to work
            //loggerMock.Verify(l=>l.Error(It.IsAny<string>(), It.IsAny<NotSupportedException>()));
        }
Ejemplo n.º 3
0
        public void IgnorePropertiesWithErrors()
        {
            var loggerMock = new Mock <ILogger>();

            ISerializer serializer = new JsonNetSerializer(loggerMock.Object);

            var badObject = new TestObjectWithException();

            string result = serializer.Serialize(badObject);

            Assert.Equal("{\"string\":\"A string\"}", result);
            loggerMock.Verify(l => l.Error(It.IsAny <string>(),
                                           It.Is <JsonException>(ex => ex.InnerException is NotSupportedException)));
        }
Ejemplo n.º 4
0
        public void IgnorePropertiesWithErrors()
        {
            var loggerMock = new Mock<ILogger>();

            ISerializer serializer = new JsonNetSerializer(loggerMock.Object);

            var badObject = new TestObjectWithException();

            string result = serializer.Serialize(badObject);

            Assert.Equal("{\"string\":\"A string\"}", result);
            loggerMock.Verify(l => l.Error(It.IsAny<string>(),
                                           It.Is<JsonException>(ex => ex.InnerException is NotSupportedException)));
        }