示例#1
0
        public AccidentsServiceShould()
        {
            var logger = Logger.Create();

            _dbContext  = new AccidentStatisticDbContext(logger);
            _repository = new AccidentStatisticRepository(_dbContext);
            _subject    = new AccidentsService(_repository);
        }
 public AccidentsServiceShould()
 {
     _mocker      = new AutoMocker();
     _autoFixture = new Fixture();
     _autoFixture.Behaviors
     .OfType <ThrowingRecursionBehavior>()
     .ToList().ForEach(b => _autoFixture.Behaviors.Remove(b));
     _autoFixture.Behaviors.Add(new OmitOnRecursionBehavior(1));
     _subject        = _mocker.CreateInstance <AccidentsService>();
     _repositoryMock = _mocker.GetMock <IAccidentStatisticRepository>();
     _pagingResult   = _autoFixture.Create <Paging <AccidentStatisticDb> >();
     _repositoryMock.Setup(x => x.Get(
                               It.IsAny <Expression <Func <AccidentStatisticDb, bool> > >(),
                               It.IsAny <Domain.EntityFramework.SortOptions <AccidentStatisticDb> >(),
                               It.IsAny <int>(),
                               It.IsAny <int>()))
     .ReturnsAsync(() => _pagingResult);
 }