public async Task GetAllAsync_ShouldReturnIEnumerableBreweryyDTOAsync() { //Arrange var options = InMemory.GetOptions("GetAllAsync_ShouldReturnIEnumerableBreweryyDTOAsync"); using (var context = new BOContext(options)) { var country = new Country() { Name = "Bulgaria", Breweries = new List <Brewery>() { new Brewery() { Name = "Brewery" } } }; context.Countries.Add(country); await context.SaveChangesAsync(); } using (var context = new BOContext(options)) { //Act var sut = new BreweryServices(context); var result = await sut.GetAllAsync(); //Assert Assert.IsInstanceOfType(result, typeof(IEnumerable <BreweryDTO>)); } }
public async Task GetAllAsync_ShouldReturnNullBreweryIfModelHasNoNameAsync() { //Arrange var options = InMemory.GetOptions("GetAllAsync_ShouldReturnNullBreweryIfModelHasNoNameAsync"); using (var context = new BOContext(options)) { var country = new Country() { Name = "Bulgaria", Breweries = new List <Brewery>() { new Brewery() } }; context.Countries.Add(country); await context.SaveChangesAsync(); } using (var context = new BOContext(options)) { //Act var sut = new BreweryServices(context); var result = await sut.GetAllAsync(); //Assert Assert.AreEqual(result, null); } }
public async Task GetAllAsync_ShouldReturnEmptyIfNoBreweriesAsync() { //Arrange var options = InMemory.GetOptions("GetAllAsync_ShouldReturnEmptyIfNoBreweriesAsync"); using (var context = new BOContext(options)) { } using (var context = new BOContext(options)) { //Act var sut = new BreweryServices(context); var result = await sut.GetAllAsync(); //Assert Assert.AreEqual(result.Count(), 0); } }