public void ArgTest() { var logger = new MockLogger(); logger.Reset(); ArgTestExtensions.Method1(logger); Assert.Null(logger.LastException); Assert.Equal("M1", logger.LastFormattedString); Assert.Equal(1, logger.CallCount); logger.Reset(); ArgTestExtensions.Method2(logger, "arg1"); Assert.Null(logger.LastException); Assert.Equal("M2 arg1", logger.LastFormattedString); Assert.Equal(1, logger.CallCount); logger.Reset(); ArgTestExtensions.Method3(logger, "arg1", 2); Assert.Null(logger.LastException); Assert.Equal("M3 arg1 2", logger.LastFormattedString); Assert.Equal(1, logger.CallCount); logger.Reset(); ArgTestExtensions.Method4(logger, new InvalidOperationException("A")); Assert.Equal("A", logger.LastException !.Message); Assert.Equal("M4", logger.LastFormattedString); Assert.Equal(1, logger.CallCount); logger.Reset(); ArgTestExtensions.Method5(logger, new InvalidOperationException("A"), new InvalidOperationException("B")); Assert.Equal("A", logger.LastException !.Message); Assert.Equal("M5 System.InvalidOperationException: B", logger.LastFormattedString); Assert.Equal(1, logger.CallCount); logger.Reset(); ArgTestExtensions.Method6(logger, new InvalidOperationException("A"), 2); Assert.Equal("A", logger.LastException !.Message); Assert.Equal("M6 2", logger.LastFormattedString); Assert.Equal(1, logger.CallCount); logger.Reset(); ArgTestExtensions.Method7(logger, 1, new InvalidOperationException("B")); Assert.Equal("B", logger.LastException !.Message); Assert.Equal("M7 1", logger.LastFormattedString); Assert.Equal(1, logger.CallCount); logger.Reset(); ArgTestExtensions.Method8(logger, 1, 2, 3, 4, 5, 6, 7); Assert.Equal("M81234567", logger.LastFormattedString); Assert.Equal(1, logger.CallCount); logger.Reset(); ArgTestExtensions.Method9(logger, 1, 2, 3, 4, 5, 6, 7); Assert.Equal("M9 1 2 3 4 5 6 7", logger.LastFormattedString); Assert.Equal(1, logger.CallCount); logger.Reset(); ArgTestExtensions.Method10(logger, 1); Assert.Equal("M101", logger.LastFormattedString); Assert.Equal(1, logger.CallCount); }