public void Run_ThrowsArgumentNullException() { // Arrange var mockService = new Mock <IContractStatusChangePublisher>(MockBehavior.Strict); var function = new ContractApprovedNotifierServiceBusFunction(mockService.Object); // Act Func <Task> act = async() => { await function.RunAsync(null, null); }; // Assert act.Should().Throw <ArgumentNullException>(); mockService.VerifyNoOtherCalls(); }
public void Run_DoesNotThrowException() { // Arrange var mockService = new Mock <IContractStatusChangePublisher>(MockBehavior.Strict); mockService .Setup(e => e.NotifyContractApprovedAsync(It.IsAny <Contract>())) .Returns(Task.CompletedTask) .Verifiable(); var function = new ContractApprovedNotifierServiceBusFunction(mockService.Object); // Act Func <Task> act = async() => { await function.RunAsync(new Contract(), null); }; // Assert act.Should().NotThrow(); mockService.Verify(); }