public async Task AndIsANonLevyEmployer_ThenContinuesToAction( [Frozen] ServiceParameters serviceParameters, [Frozen] Mock <IMediator> mockMediator, GetLegalEntitiesResponse legalEntitiesResponse, IEnumerable <AccountLegalEntity> legalEntities, string employerAccountId, long decodedId, [Frozen] Mock <IEncodingService> mockEncodingService, [ArrangeActionContext] ActionExecutingContext context, [Frozen] Mock <ActionExecutionDelegate> nextMethod, LevyNotPermittedFilter filter) { //Arrange serviceParameters.AuthenticationType = AuthenticationType.Employer; legalEntitiesResponse.AccountLegalEntities = legalEntities; context.RouteData.Values.Add("employerAccountId", employerAccountId); foreach (var legalEntity in legalEntitiesResponse.AccountLegalEntities) { legalEntity.IsLevy = false; } mockEncodingService .Setup(x => x.TryDecode(employerAccountId, EncodingType.AccountId, out decodedId)) .Returns(true); mockMediator .Setup(x => x.Send(It.Is <GetLegalEntitiesQuery>(y => y.AccountId == decodedId), It.IsAny <CancellationToken>())) .ReturnsAsync(legalEntitiesResponse); //Act await filter.OnActionExecutionAsync(context, nextMethod.Object); //Assert Assert.Null(context.Result); nextMethod.Verify(x => x(), Times.Once); }
public async Task AndIsProvider_ThenContinuesToAction( [Frozen] ServiceParameters serviceParameters, [ArrangeActionContext] ActionExecutingContext context, [Frozen] Mock <ActionExecutionDelegate> nextMethod, LevyNotPermittedFilter filter) { //Arrange serviceParameters.AuthenticationType = AuthenticationType.Provider; //Act await filter.OnActionExecutionAsync(context, nextMethod.Object); //Assert nextMethod.Verify(x => x(), Times.Once); Assert.Null(context.Result); }