public async Task Then_The_Repository_Is_Called( bool returnValue, Domain.Models.CourseDemand courseDemand, [Frozen] Mock <ICourseDemandRepository> repository, CourseDemandService service) { repository.Setup(x => x.Insert(It.Is <Domain.Entities.CourseDemand>( c => !c.EmailVerified && c.Id.Equals(courseDemand.Id) && c.Lat.Equals(courseDemand.Location.Lat) && c.Long.Equals(courseDemand.Location.Lon) && c.LocationName.Equals(courseDemand.Location.Name) && c.CourseId.Equals(courseDemand.Course.Id) && c.CourseTitle.Equals(courseDemand.Course.Title) && c.CourseLevel.Equals(courseDemand.Course.Level) && c.CourseRoute.Equals(courseDemand.Course.Route) && c.OrganisationName.Equals(courseDemand.OrganisationName) && c.ContactEmailAddress.Equals(courseDemand.ContactEmailAddress) && c.NumberOfApprentices.Equals(courseDemand.NumberOfApprentices) ))).ReturnsAsync(returnValue); var actual = await service.CreateDemand(courseDemand); actual.Should().Be(returnValue); }
public async Task Then_The_Repository_Is_Called_And_Total_Returned( int totalResults, int ukprn, [Frozen] Mock <ICourseDemandRepository> mockRepository, CourseDemandService service) { //Arrange mockRepository.Setup(x => x.TotalCourseDemands(ukprn)).ReturnsAsync(totalResults); //Act var actual = await service.GetAggregatedDemandTotal(ukprn); //Assert actual.Should().Be(totalResults); }
public async Task Then_The_Repository_Is_Called( int ukprn, int?courseId, double?lat, double?lon, int?radius, List <Domain.Entities.AggregatedCourseDemandSummary> listFromRepo, [Frozen] Mock <ICourseDemandRepository> mockRepository, CourseDemandService service) { mockRepository .Setup(repository => repository.GetAggregatedCourseDemandList(ukprn, courseId, lat, lon, radius)) .ReturnsAsync(listFromRepo); var result = await service.GetAggregatedCourseDemandList(ukprn, courseId, lat, lon, radius); result.Should().BeEquivalentTo(listFromRepo, options => options.Excluding(c => c.DistanceInMiles)); }