public async void GetPatternByIDAsyncShouldReturnPattern() { using (var context = new ProjectDBContext(options)) { IProjectRepoDB _repo = new ProjectRepoDB(context); Pattern testPattern = new Pattern(); testPattern.Id = 1; testPattern.PatternData = "123"; var foundPattern = await _repo.GetPatternByIDAsync(1); Assert.Equal(1, testPattern.Id); } }
public async Task GetPatternByIDAsync_ShouldReturnPattern() { //arrange int id = 1; ProjectDBContext projectDBContext = new ProjectDBContext(options); ProjectRepoDB projectRepoDB = new ProjectRepoDB(projectDBContext); //act var result = await projectRepoDB.GetPatternByIDAsync(id); //assert Assert.Equal(1, result.Id); }
public async void DeletePatternAsyncShouldDeletePattern() { using (var context = new ProjectDBContext(options)) { IProjectRepoDB _repo = new ProjectRepoDB(context); Pattern testPattern = new Pattern(); testPattern.Id = 4; testPattern.PatternData = "123"; var newPattern = await _repo.AddPatternAsync(testPattern); var deletedPattern = await _repo.DeletePatternAsync(testPattern); using (var assertContext = new ProjectDBContext(options)) { var result = await _repo.GetPatternByIDAsync(4); Assert.Null(result); } } }