public async Task <Tuple <int, List <SolarSystem> > > SearchSolarSystemAsync(Pagination pagination, Ordering ordering, IFilter <SolarSystem> filter) { try { return(await m_repository.SearchAsync(pagination, ordering, filter)); } catch (Exception e) { m_logger.LogCritical(e, "Unexpected Exception while trying to search for Solar Systems"); throw; } }
private async Task CheckSolarSystemExistsAsync(Guid solarSystemId) { var(_, searchResult) = await m_solarSystemService.SearchAsync(new Pagination(), new Ordering(), new SolarSystemFilter { SearchTerm = solarSystemId.ToString() }); if (!searchResult.Any()) { throw new ValidationException("No Solar System was found for the specified Id"); } }
public async Task AddAndDeleteNewSolarSystem_Ok() { //Arrange var id = Guid.NewGuid(); var system = new SolarSystem { Id = id, Name = "Test" }; //Act await m_repository.CreateAsync(system); //Assert var(_, systems) = await m_repository.SearchAsync(new Pagination(), new Ordering(), new SolarSystemFilter { SearchTerm = id.ToString() }); Assert.Equal(id, systems.First().Id); Assert.Equal("Test", systems.First().Name); await m_repository.DeleteAsync(system); var(_, emptyResponse) = await m_repository.SearchAsync(new Pagination(), new Ordering(), new SolarSystemFilter { SearchTerm = id.ToString() }); Assert.Empty(emptyResponse); }