public virtual async Task <IEnumerable <ApartComplex> > AggregateData() { var apartComplexes = await _apartComplexHandler.GetApartComplexes(); await _apartmentHandler.SetApartments(apartComplexes); return(apartComplexes); }
public async Task SetApartments() { // Arrange var apartments = CreateApartments().ToList(); var apartComplexes = CreateApartComplexes().ToList(); var htmlWebMock = new Mock <HtmlWeb>(); var htmlParserMock = new Mock <HtmlParser>(htmlWebMock.Object); var pageHandlerMock = MockPageHandler(htmlParserMock, apartments, apartComplexes); var apartmentHandler = new ApartmentHandler(pageHandlerMock.Object); // Act await apartmentHandler.SetApartments(apartComplexes); // Assert Assert.True(CompareApartments(apartments[0], apartComplexes[0].Apartments.ToList()[0])); Assert.True(CompareApartments(apartments[1], apartComplexes[0].Apartments.ToList()[1])); Assert.True(CompareApartments(apartments[2], apartComplexes[1].Apartments.ToList()[0])); Assert.True(CompareApartments(apartments[3], apartComplexes[1].Apartments.ToList()[1])); }