Пример #1
0
        private static MapperConfiguration Configure()
        {
            var config = new MapperConfiguration(cfg =>
            {
                AutoMapperBusinessConfig.Configure(cfg);
            });

            return(config);
        }
Пример #2
0
        private MockContext()
        {
            Entities = new List <object>();
            _random  = new Random();

            var unitOfWorkFactoryMock = new Mock <IUnitOfWorkFactory>(MockBehavior.Strict);
            var unitOfWorkMock        = new Mock <IUnitOfWork>(MockBehavior.Strict);

            unitOfWorkMock.Setup(m => m.GetRepository <Fact>()).Returns(CreateRepository <Fact>());
            unitOfWorkMock.Setup(m => m.GetRepository <Category>()).Returns(CreateRepository <Category>());

            unitOfWorkFactoryMock.Setup(m => m.Create()).Returns(unitOfWorkMock.Object);
            unitOfWorkMock.Setup(m => m.Dispose());
            unitOfWorkMock.Setup(m => m.SaveChanges());

            _unitOfWorkFactory = unitOfWorkFactoryMock.Object;

            _mapperConfiguration = new MapperConfiguration(cfg =>
            {
                AutoMapperBusinessConfig.Configure(cfg);
            });
        }