public async Task Given_AValidDateRangeEffectiveContractObject_When_PutIsInvoked_Then_ValidateContractMethodShouldOnlyBeInvokedOnce() { MockContractValidator.Setup(m => m.ValidateContract(It.IsAny <DateRangeEffectiveContractObject>())).ReturnsAsync(new string[0]); MockDateRangeEffectiveObjectsDal.Setup(m => m.Update(It.IsAny <DateRangeEffectiveDtoObject>())).ReturnsAsync(new DateRangeEffectiveDtoObject()); await(await DateRangeEffectiveContractObjectsController.Put(new DateRangeEffectiveContractObject())).ExecuteAsync(CancellationToken.None); MockContractValidator.Verify(m => m.ValidateContract(It.IsAny <DateRangeEffectiveContractObject>()), Times.Once); }
public async Task Given_AnInvalidDateRangeEffectiveContractObject_When_PostIsInvoked_Then_ValidateContractMethodShouldOnlyBeInvokedOnce() { MockContractValidator.Setup(m => m.ValidateContract(It.IsAny <DateRangeEffectiveContractObject>())).ReturnsAsync(new[] { StaticTestValues.ContractValidatorErrorMessage1 }); MockDateRangeEffectiveObjectsDal.Setup(m => m.Create(It.IsAny <DateRangeEffectiveDtoObject>())).ReturnsAsync(new DateRangeEffectiveDtoObject()); await(await DateRangeEffectiveContractObjectsController.Post(new DateRangeEffectiveContractObject())).ExecuteAsync(CancellationToken.None); MockContractValidator.Verify(m => m.ValidateContract(It.IsAny <DateRangeEffectiveContractObject>()), Times.Once); }
public async Task Given_ADateRangeEffectiveContractObjectWithAnInvalidEffectiveDateRange_When_PutIsInvoked_Then_ValidateContractMethodShouldOnlyBeInvokedOnce() { MockContractValidator.Setup(m => m.ValidateContract(It.IsAny <DateRangeEffectiveContractObject>())).ReturnsAsync(new string[0]); await(await DateRangeEffectiveContractObjectsController.Put(new DateRangeEffectiveContractObject { EffectiveStartDate = DateTimeOffset.MaxValue, EffectiveEndDate = DateTimeOffset.MinValue })).ExecuteAsync(CancellationToken.None); MockContractValidator.Verify(m => m.ValidateContract(It.IsAny <DateRangeEffectiveContractObject>()), Times.Once); }