public async void LunchRepository_CreateTeamAsync_CreatesATeam() { // arrange LunchContext context = GetContext(); LunchRepository target = new LunchRepository(context); const string Name = "bob's team"; const string Zip = "90210"; // act int result = await target.CreateTeamAsync(Name, Zip); // assert var team = context.Teams.First(); Assert.Equal(Name, team.Name); Assert.Equal(Zip, team.Zip); Assert.Equal(team.Id, result); }
public async void LunchRepository_UpdateTeamAsync_UpdatesTeam() { // arrange LunchContext context = GetContext(); LunchRepository target = new LunchRepository(context); const string Name = "bob's team"; const string Zip = "90210"; const string NewName = "fanny's team"; const string NewZip = "00501"; int id = await target.CreateTeamAsync(Name, Zip); await target.UpdateTeamAsync(id, NewName, NewZip); // act var result = context.Teams.Where(u => u.Id == id).Single(); // assert Assert.Equal(NewName, result.Name); Assert.Equal(NewZip, result.Zip); }