public void LogsTimeOnInvalidGet()
        {
            var log        = new Log();
            var clock      = new StaticClock();
            var repository = new RecipeRepositoryUsingDependencyInjection(log, clock);

            repository.Invoking(r => r.Get(Guid.NewGuid())).ShouldThrow <ArgumentException>();

            log.Get().First().Time.Should().Be(clock.Now);
        }
        public void LogsInvalidGetWithMock()
        {
            var log = new Mock <ILog>();

            log.Setup(l => l.Error(It.IsAny <DateTime>(), It.IsAny <string>()));
            var clock = new Mock <IClock>();

            var repository = new RecipeRepositoryUsingDependencyInjection(log.Object, clock.Object);

            repository.Invoking(r => r.Get(Guid.NewGuid())).ShouldThrow <ArgumentException>();

            log.Verify(l => l.Error(It.IsAny <DateTime>(), It.IsAny <string>()), Times.Exactly(1));
        }
 public RecipeCounter(SystemClock clock, RecipeRepositoryUsingDependencyInjection repository)
 {
     _clock      = clock;
     _repository = repository;
 }