public void GivenFakeLogShouldLogPerformance() { FizzBuzzCastleController fizzBuzzCastleController = new FizzBuzzCastleController(_logFake); fizzBuzzCastleController.Get(15); _logFake.LogEntries.Count.Should().Be(2); }
public void GivenDefaultConstructionShouldNotThrow() { FizzBuzzCastleController fizzBuzzCastleController = new FizzBuzzCastleController(); string actual = string.Empty; Action action = () => { actual = fizzBuzzCastleController.Get(1); }; action.ShouldNotThrow(); actual.Should().Be("1"); }
public void GivenExceptionShouldLogExceptionDetails() { IQuestion interfaceProxyWithTarget = (IQuestion) new ProxyGenerator() .CreateInterfaceProxyWithTarget(typeof(IQuestion), new FakeFizzBuzzQuestion(), new PerformanceMonitor(_logFake)); FizzBuzzCastleController fizzBuzzCastleController = new FizzBuzzCastleController(interfaceProxyWithTarget); Action action = () => { fizzBuzzCastleController.Get(1); }; action.ShouldThrow <Exception>(); _logFake.LogEntries.Count.Should().Be(3); _logFake.LogEntries[1].EventType().ToString().Should().Be(new EventTypes().Error()); }