public async Task AddPatternAsyncShouldAddPattern() { var newPattern = new Pattern(); _projectBLMock.Setup(x => x.AddPatternAsync(It.IsAny <Pattern>())).Returns(Task.FromResult <Pattern>(newPattern)); var newProjBL = new ProjBL(_projectBLMock.Object); var result = await newProjBL.AddPatternAsync(newPattern); Assert.Equal(result, newPattern); _projectBLMock.Verify(x => x.AddPatternAsync(It.IsAny <Pattern>())); }
public async Task AddPatternAsync_ShouldReturnNull_WhenPatternIsNull() { //arrange Pattern pattern = null; _projectBLMock.Setup(i => i.AddPatternAsync(It.IsAny <Pattern>())).Returns(Task.FromResult <Pattern>(pattern)); var newProjBL = new ProjBL(_projectBLMock.Object); //act var result = await newProjBL.AddPatternAsync(pattern); //assert Assert.Null(result); _projectBLMock.Verify(i => i.AddPatternAsync(It.IsAny <Pattern>())); }