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); }
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); }
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); }
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); }
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()); }
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); }
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; }