public void ActionsByInventarizationsWorks() { // DELETE FROM public."Tasks"; //DELETE FROM public."Users"; //DELETE FROM public."Actions"; //DELETE FROM public."Zones"; //DELETE FROM public."Inventorizations"; //DELETE FROM public."Companies" User user = userRepositoriy.CreateUser(new User() { FirstName = "test_name", FamilyName = "test_family", MiddleName = "test_middlename", Level = UserLevel.Scaner, CreatedAt = DateTime.UtcNow, Login = "******", Password = "******" }); Company company = companyRepositoriy.CreateCompany("Тест1"); Business.Model.Inventorization inventarisation = inventorizationRepositoriy.CreateInventorization(company.Id, DateTime.UtcNow); Guid firstActionId = Guid.NewGuid(); Guid secondActionId = Guid.NewGuid(); Business.Model.Action firstAction = new Business.Model.Action() { Id = firstActionId, DateTime = DateTime.UtcNow, Type = ActionType.FirstScan, UserId = user.Id, Inventorization = inventarisation.Id, BarCode = "1", Quantity = 1, }; Business.Model.Action secondAction = new Business.Model.Action() { Id = firstActionId, DateTime = DateTime.UtcNow, Type = ActionType.FirstScan, UserId = user.Id, Zone = inventarisation.Id, BarCode = "1", Quantity = 1, }; actionRepository.CreateAction(firstAction); actionRepository.CreateAction(secondAction); List <Business.Model.Action> actions = actionRepository.GetActionsByInventorization(inventarisation.Id); Assert.IsNotNull(actions); Assert.AreEqual(2, actions.Count()); actionRepository.DeleteAction(firstActionId); actionRepository.DeleteAction(secondActionId); inventorizationRepositoriy.DeleteInventorization(inventarisation.Id); companyRepositoriy.DeleteCompany(company.Id); userRepositoriy.DeleteUser(user.Id); }
public void TestCreateActionReturnsContainerItem() { var mockItem = new Mock<IAction>(MockBehavior.Strict); var container = new Mock<IObjectContainer>(MockBehavior.Strict); container.Setup(c => c.Resolve(typeof(IAction), null)).Returns(mockItem.Object); var repository = new ActionRepository(container.Object); var result = repository.CreateAction<IAction>(); Assert.IsNotNull(result); Assert.AreSame(mockItem.Object, result); container.VerifyAll(); mockItem.VerifyAll(); }
public void TestCreateActionReturnsContainerItem() { var mockItem = new Mock <IAction>(MockBehavior.Strict); var container = new Mock <IObjectContainer>(MockBehavior.Strict); container.Setup(c => c.Resolve(typeof(IAction), null)).Returns(mockItem.Object); var repository = new ActionRepository(container.Object); var result = repository.CreateAction <IAction>(); Assert.IsNotNull(result); Assert.AreSame(mockItem.Object, result); container.VerifyAll(); mockItem.VerifyAll(); }