public void ConfigureFileLogging() { MOCK_ConfigureFileLogging((int verbosity, string filename, ref IntPtr genfn, ref int genfnsize, string timefmt, string fmt) => { Assert.Equal((int)Yogi.Verbosity.Info, verbosity); Assert.Equal("foo", filename); Assert.Null(timefmt); Assert.Null(fmt); genfn = helloBytes; genfnsize = helloSize; return((int)Yogi.ErrorCode.Ok); }); Assert.Equal("hello", Yogi.ConfigureFileLogging(Yogi.Verbosity.Info, "foo")); MOCK_ConfigureFileLogging((int verbosity, string filename, ref IntPtr genfn, ref int genfnsize, string timefmt, string fmt) => { Assert.Equal((int)Yogi.Verbosity.Trace, verbosity); Assert.Equal("moo", filename); Assert.Equal("foo", timefmt); Assert.Equal("bar", fmt); genfn = helloBytes; genfnsize = helloSize; return((int)Yogi.ErrorCode.Ok); }); Assert.Equal("hello", Yogi.ConfigureFileLogging(Yogi.Verbosity.Trace, "moo", "foo", "bar")); }
public void ConfigureFileLoggingError() { MOCK_ConfigureFileLogging((int verbosity, string filename, ref IntPtr genfn, ref int genfnsize, string timefmt, string fmt) => { return((int)Yogi.ErrorCode.Unknown); }); Assert.ThrowsAny <Yogi.FailureException>(() => { Yogi.ConfigureFileLogging(Yogi.Verbosity.Info, "foo"); }); }