public StockServiceTests()
 {
     Mock    = DefaultContextMock.GetMock();
     MockSet = SetUpMock.SetUpFor(testEntities);
     Mock.Setup(c => c.Set <Stock>()).Returns(MockSet.Object);
     Mock.Setup(c => c.Stock).Returns(MockSet.Object);
     testedService = new StockService(Mock.Object);
 }
Exemple #2
0
        public AbstractBaseServiceTests()
        {
            long Id = singleEntity.Id;

            Mock    = DefaultContextMock.GetMock();
            MockSet = SetUpMock.SetUpFor(testEntities);
            Mock.Setup(c => c.Set <Country>()).Returns(MockSet.Object);
            testedService = new AbstractBaseService(Mock.Object);
        }
Exemple #3
0
        public CitiesServiceTests()
        {
            long Id = singleEntity.Id;

            Mock    = DefaultContextMock.GetMock();
            MockSet = SetUpMock.SetUpFor(testEntities);
            Mock.Setup(c => c.Set <City>()).Returns(MockSet.Object);
            Mock.Setup(c => c.City).Returns(MockSet.Object);
            testedService = new CitiesService(Mock.Object);
        }
Exemple #4
0
        public BusinessDirectionsServiceTests()
        {
            long Id = singleEntity.Id;

            Mock    = DefaultContextMock.GetMock();
            MockSet = SetUpMock.SetUpFor(testEntities);
            Mock.Setup(c => c.Set <BusinessDirection>()).Returns(MockSet.Object);
            Mock.Setup(c => c.BusinessDirection).Returns(MockSet.Object);
            testedService = new BusinessDirectionsService(Mock.Object);
        }
        public WarehouseServiceTests()
        {
            long Id = singleEntity.Id;

            Mock    = DefaultContextMock.GetMock();
            MockSet = SetUpMock.SetUpFor(testEntities);
            Mock.Setup(c => c.Set <Warehouse>()).Returns(MockSet.Object);
            Mock.Setup(c => c.Warehouse).Returns(MockSet.Object);
            testedService = new WarehouseService(Mock.Object);
        }
Exemple #6
0
        public PeopleServiceTests()
        {
            long Id = singleEntity.Id;

            Mock    = DefaultContextMock.GetMock();
            MockSet = SetUpMock.SetUpFor(testEntities);
            Mock.Setup(c => c.Set <Person>()).Returns(MockSet.Object);
            Mock.Setup(c => c.Person).Returns(MockSet.Object);
            testedService = new PeopleService(Mock.Object, new FakeRoleManager(), new FakeUserManager());
        }
Exemple #7
0
        public DocumentTypesServiceTests()
        {
            long Id = singleEntity.Id;

            Mock    = DefaultContextMock.GetMock();
            MockSet = SetUpMock.SetUpFor(testEntities);
            Mock.Setup(c => c.Set <DocumentType>()).Returns(MockSet.Object);
            Mock.Setup(c => c.DocumentType).Returns(MockSet.Object);
            testedService = new DocumentTypesService(Mock.Object);
        }
Exemple #8
0
        public EntitiesMock()
        {
            long Id      = singleEntity.Id;
            var  mockSet = SetUpMock.SetUpFor(testEntities);
            var  mock    = new Mock <IExpencesService>();

            mock.Setup(c => c.GetIQueryable()).Returns(mockSet.Object);
            mock.Setup(c => c.GetFilteredContentAsync(It.IsAny <int?>(),
                                                      It.IsAny <ExpencesFiltredModel>(),
                                                      It.IsAny <string>(),
                                                      It.IsAny <bool>()))
            .Returns(Task.FromResult(new ExpencesFiltredModel()));
            mock.Setup(c => c.GetListAsync()).Returns(Task.FromResult(testEntities.AsEnumerable()));
            mock.Setup(c => c.GetAsync(Id, It.IsAny <bool>()))
            .Returns(Task.FromResult(singleEntity));
            ValidController    = new ExpencesController(new FakeUserManager(), mock.Object);
            NotValidController = new ExpencesController(new FakeUserManager(), mock.Object);
            NotValidController.ModelState.AddModelError("Name", "Some Error");
            Mock = mock;
        }