public void CallToSaveList_DoesSetActiveFlagToTrueWhenIsDeleteFalseAndActiveFalse() { // arrange Mock <IInventoryValuationListHeadersRepository> mockHeaderRepo = new Mock <IInventoryValuationListHeadersRepository>(); Mock <IInventoryValuationListDetailsRepository> mockDetailsRepo = new Mock <IInventoryValuationListDetailsRepository>(); InventoryValuationListLogicImpl testunit = new InventoryValuationListLogicImpl(mockHeaderRepo.Object, mockDetailsRepo.Object); UserSelectedContext testcontext = new UserSelectedContext { BranchId = "FUT", CustomerId = "123456" }; UserProfile fakeUser = new UserProfile(); ListModel testList = new ListModel { ListId = 1, CustomerNumber = "123456", BranchId = "FUT", Items = new List <ListItemModel> { new ListItemModel { ItemNumber = "123456", Active = false, IsDelete = false } } }; // act ListModel results = testunit.SaveList(fakeUser, testcontext, testList); // assert mockDetailsRepo.Verify(h => h.SaveInventoryValuationDetail(It.Is <InventoryValuationListDetail>(d => d.Active.Equals(true))), Times.Once(), "Error updating"); }
public void CallToSaveList_DoesCallHeaderRepo() { // arrange Mock <IInventoryValuationListHeadersRepository> mockHeaderRepo = new Mock <IInventoryValuationListHeadersRepository>(); Mock <IInventoryValuationListDetailsRepository> mockDetailsRepo = new Mock <IInventoryValuationListDetailsRepository>(); InventoryValuationListLogicImpl testunit = new InventoryValuationListLogicImpl(mockHeaderRepo.Object, mockDetailsRepo.Object); UserSelectedContext testcontext = new UserSelectedContext { BranchId = "FUT", CustomerId = "123456" }; UserProfile fakeUser = new UserProfile(); ListModel testList = new ListModel { ListId = 1, CustomerNumber = "123456", BranchId = "FUT", Items = new List <ListItemModel> { new ListItemModel { ItemNumber = "123456" } } }; // act ListModel results = testunit.SaveList(fakeUser, testcontext, testList); // assert mockHeaderRepo.Verify(h => h.SaveInventoryValuationListHeader(It.IsAny <InventoryValuationListHeader>()), Times.Once(), "Error updating"); }