[ExpectedException(typeof(NullReferenceException))] // Assert public async void DeleteProtocol_Fail_ProtocolDoesNotExist_Test() { //Arrange var repositoryMock = new Mock<IRepository<StoredProtocol>>(); const int toDeleteId = 0; repositoryMock.Setup(r => r.DeleteIfExists(toDeleteId)).Returns(Task.FromResult(false)); var adapter = new ProtocolAdapter(repositoryMock.Object); //Act await adapter.DeleteIfExists(toDeleteId); }
public async void DeleteProtocol_Success_Test() { //Arrange var repositoryMock = new Mock<IRepository<StoredProtocol>>(); const int toDeleteId = 0; repositoryMock.Setup(r => r.DeleteIfExists(toDeleteId)).Returns(Task.FromResult(true)); var adapter = new ProtocolAdapter(repositoryMock.Object); //Act var result = await adapter.DeleteIfExists(toDeleteId); //Assert Assert.IsTrue(result); }