public void Should_return_null_when_phone_notExist() { //Arrange var existingUserId = 6; Phone phone = null; PhoneRepositoryMock .Setup(i => i.ReadOneAsync(existingUserId)) .ReturnsAsync(phone); //Act var result = ContactServiceUnderTest.ReadOnePhoneAsync(existingUserId); //Assert Assert.Null(result.Result); }
public void Should_return_Phone_when_user_Id_exist() { //Arrange var existingUserId = 6; var expectedPhone = PhoneData; PhoneRepositoryMock .Setup(i => i.ReadOneAsync(existingUserId)) .ReturnsAsync(expectedPhone); //Act var result = ContactServiceUnderTest.ReadOnePhoneAsync(existingUserId); //Assert Assert.Same(expectedPhone, result.Result); }