public async Task GetSectionsBySalonYearSectionTypeIds_GetsFromDb() { // Arrange var salonYear = EntitiesHelper.GetSalonYear(); var sectionType1 = EntitiesHelper.GetSectionType(); var sectionType2 = EntitiesHelper.GetSectionType(); var lCreatedEntity1 = await sectionRepository.Add(new Entities.SectionEntity { SalonYear = salonYear, SectionType = sectionType1 }); var lCreatedEntity2 = await sectionRepository.Add(new Entities.SectionEntity { SalonYear = salonYear, SectionType = sectionType2 }); var lCreatedEntity3 = await sectionRepository.Add(new Entities.SectionEntity { SalonYear = EntitiesHelper.GetSalonYear(), SectionType = sectionType2 }); var lCreatedEntity4 = await sectionRepository.Add(new Entities.SectionEntity { SalonYear = salonYear, SectionType = EntitiesHelper.GetSectionType() }); // Act var lResult = await sectionRepository.GetSectionsBySalonYearSectionTypeIds(salonYear.Id, new List <int> { sectionType1.Id, sectionType2.Id }); // Assert Assert.IsNotNull(lResult); Assert.AreEqual(2, lResult.Count); }
public async Task GetSection_GetsFromDb() { // Arrange var lCreatedEntity = await sectionRepository.Add(new Entities.SectionEntity { SalonYear = EntitiesHelper.GetSalonYear(), SectionType = EntitiesHelper.GetSectionType() }); // Act var lResult = await sectionRepository.GetById(lCreatedEntity.Id); // Assert Assert.IsNotNull(lResult); Assert.IsTrue(lResult.Id > 0); }
public async Task UpdateSection_SetsNameInDb() { // Arrange var lCreatedEntity = await sectionRepository.Add(new Entities.SectionEntity { SalonYear = EntitiesHelper.GetSalonYear(), SectionType = EntitiesHelper.GetSectionType() }); var lNewSalonYear = EntitiesHelper.GetSalonYear(); lNewSalonYear.Name = "new salon year"; lCreatedEntity.SalonYear = lNewSalonYear; // Act await sectionRepository.Update(lCreatedEntity); // Assert var lResult = await sectionRepository.GetById(lCreatedEntity.Id); Assert.IsNotNull(lResult); Assert.IsTrue(lResult.Id > 0); Assert.AreEqual("new salon year", lResult.SalonYear.Name); }