示例#1
0
        public void LogsInvalidGet()
        {
            ServiceLocator.Log   = new Log();
            ServiceLocator.Clock = new StaticClock();
            var repository = new RecipeRepositoryUsingServiceLocator();

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

            ServiceLocator.Log.Get().Should().HaveCount(1);
        }
示例#2
0
        public void LogsMultipleInvalidGets()
        {
            ServiceLocator.Log = new Log();
            var repository = new RecipeRepositoryUsingServiceLocator();

            #region expected fail
            // this test should fail in isolated runs due to the missing initialization of ServiceLocator.Clock
            #endregion
            repository.Invoking(r => r.Get(Guid.NewGuid())).ShouldThrow <ArgumentException>();
            repository.Invoking(r => r.Get(Guid.NewGuid())).ShouldThrow <ArgumentException>();

            ServiceLocator.Log.Get().Should().HaveCount(2);
        }