Beispiel #1
0
        public void should_allow_matching_of_same_shape()
        {
            var logSpy  = new LoggingSpy();
            var content = new { Some = "Content" };

            logSpy.Logger.Info(content);

            Assert.True(logSpy.DidInfo(new { Some = "Content" }));
        }
Beispiel #2
0
        public void should_allow_actual_to_have_extra_content()
        {
            var logSpy  = new LoggingSpy();
            var content = new { Some = "Content", Extra = "Content" };

            logSpy.Logger.Info(content);

            Assert.True(logSpy.DidInfo(new { Some = "Content" }));
        }
Beispiel #3
0
        public void should_be_false_when_no_matching_log_found(object actual, object expected)
        {
            var logSpy  = new LoggingSpy();
            var content = new { Some = actual };

            logSpy.Logger.Info(content);

            Assert.False(logSpy.DidInfo(new { Some = expected }));
        }
Beispiel #4
0
        public void should_not_match_complex_and_value_type()
        {
            var logSpy  = new LoggingSpy();
            var content = new { Some = new { Complex = false } };

            logSpy.Logger.Info(content);

            Assert.False(logSpy.DidInfo(new { Some = "Content" }));
        }
Beispiel #5
0
        public void should_allow_predicates_to_be_mismatched <T>(T val)
        {
            var logSpy  = new LoggingSpy();
            var content = new { Something = val };

            logSpy.Logger.Info(content);

            Assert.False(logSpy.DidInfo(new { Something = new Predicate <string>(n => n == null ? val != null : !n.Equals(val)) }));
        }
Beispiel #6
0
        public void should_allow_asserting_on_info()
        {
            var logSpy          = new LoggingSpy();
            var expectedContent = new { Some = "Content" };

            logSpy.Logger.Info(expectedContent);

            Assert.True(logSpy.DidInfo(expectedContent));
        }
Beispiel #7
0
        public void should_not_allow_expected_to_have_extra_content_at_any_depth()
        {
            var logSpy  = new LoggingSpy();
            var content = new { Some = "Content", Extra = new { Content = "blah" } };

            logSpy.Logger.Info(content);

            Assert.False(logSpy.DidInfo(new { Some = "Content", Extra = new { Content = "blah", Extra = true } }));
        }
Beispiel #8
0
        public void should_not_allow_null_fields_to_match_non_null()
        {
            var logSpy  = new LoggingSpy();
            var content = new TestData()
            {
                Prop1 = 2, Prop2 = null
            };

            logSpy.Logger.Info(content);

            Assert.False(logSpy.DidInfo(new TestData()
            {
                Prop1 = 2, Prop2 = "Something here"
            }));
        }
Beispiel #9
0
        public void should_allow_fields_to_be_ignored_with_null()
        {
            var logSpy  = new LoggingSpy();
            var content = new TestData()
            {
                Prop1 = 2, Prop2 = "to ignore"
            };

            logSpy.Logger.Info(content);

            Assert.True(logSpy.DidInfo(new TestData()
            {
                Prop1 = 2, Prop2 = null
            }));
        }