/// <summary> /// Creates the bonuses mock. /// </summary> private PagedResponse<BonusAggregate> CreateMockBonuses() { var factory = new BonusFactory(EmployeeRepositoryMock.Object); var bonuses = new List<BonusAggregate> { factory.Create(new Employee("name1", "lastname1", "ukr1"), DateTime.Now, 100), factory.Create(new Employee("name2", "lastname2", "ukr2"), DateTime.Now, 200) }; return new PagedResponse<BonusAggregate>(bonuses, 2); }
public void Save_BonusesList_2BonusesAdded() { int numberOfItemsBeforSave; int numberOfCurrentBonuses; using (var dbContext = new DatabaseContext(TestUser, TestPass)) { bonusFactory = new BonusFactory(new EmployeesRepository(dbContext)); var bonusesList = new List<BonusAggregate> { bonusFactory.Create(GetEmployeeById(4), DateTime.Now, 100), bonusFactory.Create(GetEmployeeById(5), DateTime.Now, 90) }; bonusRepository = new BonusesRepository(dbContext); numberOfItemsBeforSave = bonusRepository.FindAll().Count(); bonusRepository.Save(bonusesList); numberOfCurrentBonuses = bonusRepository.FindAll().Count(); } Assert.AreEqual(numberOfCurrentBonuses - 2, numberOfItemsBeforSave); }