DoesNotContain() static public method

Asserts that a string is found within another string.
static public DoesNotContain ( string expected, string actual ) : void
expected string The expected string
actual string The string to be examined
return void
Exemplo n.º 1
0
        public virtual void Log_WithParams_automatically_generates_custom_formatter_for_array()
        {
            var writer = new StringWriter();
            var myInts = new[] { 2222, 3333, 4444 };

            using (Log.Events().Subscribe(e => writer.Write(e.ToLogString())))
            {
                Log.WithParams(() => new { myInts }).Write("a message");
            }

            var output = writer.ToString();

            StringAssert.Contains("2222", output);
            StringAssert.Contains("3333", output);
            StringAssert.Contains("4444", output);
            StringAssert.DoesNotContain(myInts.ToString(), output);
        }
Exemplo n.º 2
0
        public void Parameter_logging_can_be_disabled_per_class()
        {
            var log = new StringWriter();

            Extension <Boundaries> .DisableFor <InheritedWidget>();

            using (Log.Events().Subscribe(e => log.Write(e.ToLogString())))
            {
                var w  = new Widget();
                var iw = new InheritedWidget();
                w.DoStuff("should be in log");
                iw.DoStuff("should not be in log");
            }

            StringAssert.Contains("should be in log", log.ToString());
            StringAssert.DoesNotContain("should not be in log", log.ToString());
        }
Exemplo n.º 3
0
        public virtual void Log_with_params_can_be_disabled_globally()
        {
            Extension <Params> .Disable();

            var writer = new StringWriter();

            var someGuid = Guid.NewGuid();

            using (Log.Events().Subscribe(e => writer.Write(e.ToLogString())))
            {
                Log.WithParams(() => new { someGuid }).Write("a message");
            }

            var output = writer.ToString();

            StringAssert.DoesNotContain("someGuid", output);
            StringAssert.DoesNotContain(someGuid.ToLogString(), output);
        }