public async Task Then_Gets_Reservation_Details( ReservationsRouteModel routeModel, [Frozen] Mock <IMediator> mockMediator, ManageReservationsController controller) { await controller.Delete(routeModel); mockMediator.Verify(mediator => mediator.Send( It.Is <GetReservationQuery>(query => query.Id == routeModel.Id), CancellationToken.None), Times.Once); }
public async Task And_Has_Ukprn_And_No_Id_Then_Redirect_To_Provider_Manage( ReservationsRouteModel routeModel, DeleteViewModel viewModel, ManageReservationsController controller) { viewModel.Delete = true; routeModel.Id = null; var result = await controller.PostDelete(routeModel, viewModel) as RedirectToRouteResult; result.RouteName.Should().Be(RouteNames.ProviderManage); }
public void And_No_Ukprn_And_Manage_True_Then_Redirects_To_Employer_Manage( ReservationsRouteModel routeModel, DeleteCompletedViewModel viewModel, ManageReservationsController controller) { routeModel.UkPrn = null; viewModel.Manage = true; var result = controller.PostDeleteCompleted(routeModel, viewModel) as RedirectToRouteResult; result.RouteName.Should().Be(RouteNames.EmployerManage); }
public async Task And_No_Ukprn_And_No_Id_Then_Redirects_To_Employer_Manage( ReservationsRouteModel routeModel, ManageReservationsController controller) { routeModel.UkPrn = null; routeModel.Id = null; var result = await controller.Delete(routeModel) as RedirectToRouteResult; result.Should().NotBeNull(); result.RouteName.Should().Be(RouteNames.EmployerManage); }
public void And_Has_Ukprn_And_Model_Invalid_Then_Returns_Provider_Completed_View( ReservationsRouteModel routeModel, DeleteCompletedViewModel viewModel, ManageReservationsController controller) { controller.ModelState.AddModelError("key", "error message"); var result = controller.PostDeleteCompleted(routeModel, viewModel) as ViewResult; result.ViewName.Should().Be(ViewNames.ProviderDeleteCompleted); result.Model.Should().Be(viewModel); }
public async Task And_Delete_Invalid_And_Has_Ukprn_Then_Shows_Provider_Delete_View_Again( ReservationsRouteModel routeModel, DeleteViewModel viewModel, ManageReservationsController controller) { controller.ModelState.AddModelError("key", "error message"); var result = await controller.PostDelete(routeModel, viewModel) as ViewResult; result.ViewName.Should().Be(ViewNames.ProviderDelete); result.Model.Should().Be(viewModel); }
public async Task And_No_Ukprn_Then_Returns_List_Of_Reservations_For_Single_Employer_Account( ReservationsRouteModel routeModel, GetReservationsResult getReservationsResult, string hashedId, string expectedUrl, [Frozen] Mock <IEncodingService> mockEncodingService, [Frozen] Mock <IMediator> mockMediator, [Frozen] Mock <IExternalUrlHelper> mockExternalUrlHelper, ManageReservationsController controller) { routeModel.UkPrn = null; mockMediator .Setup(mediator => mediator.Send(It.IsAny <GetReservationsQuery>(), It.IsAny <CancellationToken>())) .ReturnsAsync(getReservationsResult); mockEncodingService .Setup(service => service.Encode(It.IsAny <long>(), EncodingType.PublicAccountLegalEntityId)) .Returns(hashedId); mockExternalUrlHelper.Setup(h => h.GenerateAddApprenticeUrl( It.IsAny <Guid>(), It.IsAny <string>(), It.IsAny <string>(), It.IsAny <uint?>(), It.IsAny <DateTime>(), It.IsAny <string>(), It.IsAny <string>(), It.IsAny <bool>())).Returns(expectedUrl); getReservationsResult.Reservations.ToList().ForEach(c => { c.Status = ReservationStatus.Pending; c.IsExpired = false; }); var expectedReservations = new List <ReservationViewModel>(); expectedReservations.AddRange( getReservationsResult.Reservations.Select( reservation => new ReservationViewModel(reservation, expectedUrl, routeModel.UkPrn))); var result = await controller.Manage(routeModel) as ViewResult; result.Should().NotBeNull(); result.ViewName.Should().Be(ViewNames.EmployerManage); var viewModel = result.Model as ManageViewModel; viewModel.Should().NotBeNull(); viewModel.Reservations.Should().BeEquivalentTo(expectedReservations, options => options.ExcludingMissingMembers()); }
public async Task And_Delete_False_And_No_Ukprn_Then_Redirects_To_Employer_Manage_Route( ReservationsRouteModel routeModel, DeleteViewModel viewModel, ManageReservationsController controller) { routeModel.UkPrn = null; routeModel.IsFromManage = null; viewModel.Delete = false; var result = await controller.PostDelete(routeModel, viewModel) as RedirectToRouteResult; result.RouteName.Should().Be(RouteNames.EmployerManage); }
public async Task Add_Apprentice_Url_UkPrn_Will_Be_Populated_From_RouteModel_Reservation( ReservationsRouteModel routeModel, GetTrustedEmployersResponse getTrustedEmployersResponse, Reservation reservation, string hashedId, string expectedUrl, [Frozen] Mock <IEncodingService> mockEncodingService, [Frozen] Mock <IMediator> mockMediator, [Frozen] Mock <IExternalUrlHelper> mockUrlHelper, ManageReservationsController controller) { mockMediator .Setup(mediator => mediator.Send(It.IsAny <GetTrustedEmployersQuery>(), It.IsAny <CancellationToken>())) .ReturnsAsync(getTrustedEmployersResponse); reservation.ProviderId = null; reservation.IsExpired = false; mockMediator .Setup(mediator => mediator.Send(It.IsAny <GetReservationsQuery>(), It.IsAny <CancellationToken>())) .ReturnsAsync(new GetReservationsResult { Reservations = new [] { reservation } }); mockEncodingService .Setup(service => service.Encode(It.IsAny <long>(), EncodingType.PublicAccountLegalEntityId)) .Returns(hashedId); mockUrlHelper.Setup(h => h.GenerateAddApprenticeUrl( reservation.Id, hashedId, reservation.Course.Id, routeModel.UkPrn, reservation.StartDate, routeModel.CohortReference, routeModel.EmployerAccountId, false, "", "")) .Returns(expectedUrl); var result = await controller.EmployerManage(routeModel) as ViewResult; var viewModel = result?.Model as ManageViewModel; viewModel.Should().NotBeNull(); Assert.IsTrue(viewModel.Reservations.All(c => c.ApprenticeUrl.Equals(expectedUrl))); }
public async Task And_Has_Ukprn_Then_Returns_List_Of_Reservations_For_All_Trusted_Employer_Accounts( [Frozen] ReservationsRouteModel routeModel, GetTrustedEmployersResponse getTrustedEmployersResponse, [ReservationsFromThisProvider] GetReservationsResult getReservationsResult1, [ReservationsFromThisProvider] GetReservationsResult getReservationsResult2, [ReservationsFromThisProvider] GetReservationsResult getReservationsResult3, string hashedId, string homeLink, [Frozen] ReservationsWebConfiguration config, [Frozen] Mock <IExternalUrlHelper> externalUrlHelper, [Frozen] Mock <IEncodingService> mockEncodingService, [Frozen] Mock <IMediator> mockMediator, ManageReservationsController controller) { mockMediator .Setup(mediator => mediator.Send(It.IsAny <GetTrustedEmployersQuery>(), It.IsAny <CancellationToken>())) .ReturnsAsync(getTrustedEmployersResponse); mockMediator .SetupSequence(mediator => mediator.Send(It.IsAny <GetReservationsQuery>(), It.IsAny <CancellationToken>())) .ReturnsAsync(getReservationsResult1) .ReturnsAsync(getReservationsResult2) .ReturnsAsync(getReservationsResult3); mockEncodingService .Setup(service => service.Encode(It.IsAny <long>(), EncodingType.PublicAccountLegalEntityId)) .Returns(hashedId); externalUrlHelper .Setup(x => x.GenerateDashboardUrl(routeModel.EmployerAccountId)).Returns(homeLink); var expectedReservations = new List <ReservationViewModel>(); expectedReservations.AddRange(getReservationsResult1.Reservations.Select(reservation => new ReservationViewModel(reservation, config.ApprenticeUrl, routeModel.UkPrn))); expectedReservations.AddRange(getReservationsResult2.Reservations.Select(reservation => new ReservationViewModel(reservation, config.ApprenticeUrl, routeModel.UkPrn))); expectedReservations.AddRange(getReservationsResult3.Reservations.Select(reservation => new ReservationViewModel(reservation, config.ApprenticeUrl, routeModel.UkPrn))); var result = await controller.Manage(routeModel) as ViewResult; result.Should().NotBeNull(); result.ViewName.Should().Be(ViewNames.ProviderManage); var viewModel = result.Model as ManageViewModel; viewModel.Should().NotBeNull(); viewModel.BackLink.Should().Be(homeLink); viewModel.Reservations.Should().BeEquivalentTo(expectedReservations, options => options.ExcludingMissingMembers().ExcludingFields().Excluding(c => c.ApprenticeUrl)); }
public async Task And_Delete_False_And_Has_Ukprn_Then_Redirects_To_Provider_Manage_Route( ReservationsRouteModel routeModel, DeleteViewModel viewModel, ManageReservationsController controller) { routeModel.IsFromManage = null; routeModel.UkPrn = 12345; viewModel.Delete = false; var result = await controller.PostDelete(routeModel, viewModel) as RedirectToRouteResult; result.RouteName.Should().Be(RouteNames.ProviderManage); result.RouteValues.Should().ContainKey("IsFromManage"); result.RouteValues["IsFromManage"].Should().Be(true); }
public async Task And_The_Provider_Has_No_TrustedEmployers_Then_A_NoPermissions_View_Is_Returned( ReservationsRouteModel routeModel, ManageReservationsFilterModel filterModel, [Frozen] Mock <IMediator> mockMediator, ManageReservationsController controller) { filterModel.SearchTerm = string.Empty; mockMediator .Setup(mediator => mediator.Send(It.IsAny <SearchReservationsQuery>(), It.IsAny <CancellationToken>())) .ThrowsAsync(new ProviderNotAuthorisedException(0, 1)); var result = await controller.ProviderManage(routeModel, filterModel) as ViewResult; result.ViewName.Should().Be("NoPermissions"); }
public void And_Has_Ukprn_And_Manage_False_Then_Redirects_To_Provider_Dashboard( ReservationsRouteModel routeModel, DeleteCompletedViewModel viewModel, string providerDashboardUrl, [Frozen] Mock <IExternalUrlHelper> externalUrlHelper, ManageReservationsController controller) { routeModel.EmployerAccountId = null; externalUrlHelper.Setup(x => x.GenerateDashboardUrl(null)).Returns(providerDashboardUrl); viewModel.Manage = false; var result = controller.PostDeleteCompleted(routeModel, viewModel) as RedirectResult; result.Url.Should().Be(providerDashboardUrl); }
public async Task And_The_Provider_Has_No_TrustedEmployers_Then_A_NoPermissions_View_Is_Returned( ReservationsRouteModel routeModel, [Frozen] Mock <IMediator> mockMediator, ManageReservationsController controller) { mockMediator .Setup(mediator => mediator.Send(It.IsAny <GetTrustedEmployersQuery>(), It.IsAny <CancellationToken>())) .ReturnsAsync(new GetTrustedEmployersResponse { Employers = new List <Employer>() }); var result = await controller.Manage(routeModel) as ViewResult; result.ViewName.Should().Be("NoPermissions"); }
public async Task And_Has_Ukprn_And_Exception_Then_Redirects_To_Provider_Error( ReservationsRouteModel routeModel, DeleteViewModel viewModel, Exception exception, [Frozen] Mock <IMediator> mockMediator, ManageReservationsController controller) { viewModel.Delete = true; mockMediator .Setup(mediator => mediator.Send(It.IsAny <DeleteReservationCommand>(), It.IsAny <CancellationToken>())) .Throws(exception); var result = await controller.PostDelete(routeModel, viewModel) as RedirectToRouteResult; result.RouteName.Should().Be(RouteNames.ProviderError); }
public async Task And_Delete_True_And_Has_Ukprn_Then_Redirects_To_Provider_Completed_Route( ReservationsRouteModel routeModel, DeleteViewModel viewModel, [Frozen] Mock <IMediator> mockMediator, ManageReservationsController controller) { viewModel.Delete = true; var result = await controller.PostDelete(routeModel, viewModel) as RedirectToRouteResult; result.RouteName.Should().Be(RouteNames.ProviderDeleteCompleted); mockMediator.Verify(mediator => mediator.Send( It.Is <DeleteReservationCommand>(command => command.ReservationId == routeModel.Id && !command.DeletedByEmployer), It.IsAny <CancellationToken>()), Times.Once); }
public async Task And_Has_Ukprn_And_ValidationException_Then_Returns_To_Provider_Delete_View( ReservationsRouteModel routeModel, DeleteViewModel viewModel, ValidationException validationException, [Frozen] Mock <IMediator> mockMediator, ManageReservationsController controller) { viewModel.Delete = true; mockMediator .Setup(mediator => mediator.Send(It.IsAny <DeleteReservationCommand>(), It.IsAny <CancellationToken>())) .Throws(validationException); var result = await controller.PostDelete(routeModel, viewModel) as ViewResult; result.ViewName.Should().Be(ViewNames.ProviderDelete); }
public async Task Then_Filter_Params_Assigned_To_View_Model( ReservationsRouteModel routeModel, ManageReservationsFilterModel filterModel, SearchReservationsResult searchResult, [Frozen] Mock <IMediator> mockMediator, ManageReservationsController controller) { mockMediator .Setup(mediator => mediator.Send(It.IsAny <SearchReservationsQuery>(), It.IsAny <CancellationToken>())) .ReturnsAsync(searchResult); var result = await controller.ProviderManage(routeModel, filterModel) as ViewResult; var viewModel = result?.Model as ManageViewModel; viewModel.FilterModel.Should().BeEquivalentTo(filterModel); }
public void And_No_Ukprn_And_Manage_False_Then_Redirects_To_Employer_Dashboard( ReservationsRouteModel routeModel, DeleteCompletedViewModel viewModel, string expectedUrl, [Frozen] Mock <IExternalUrlHelper> mockUrlHelper, ManageReservationsController controller) { routeModel.UkPrn = null; viewModel.Manage = false; mockUrlHelper .Setup(helper => helper.GenerateDashboardUrl(routeModel.EmployerAccountId)) .Returns(expectedUrl); var result = controller.PostDeleteCompleted(routeModel, viewModel) as RedirectResult; result.Url.Should().Be(expectedUrl); }
public async Task Then_Sets_Reservation_Details_On_ViewModel( ReservationsRouteModel routeModel, GetReservationResult getReservationResult, [Frozen] Mock <IMediator> mockMediator, ManageReservationsController controller) { mockMediator .Setup(mediator => mediator.Send( It.IsAny <GetReservationQuery>(), It.IsAny <CancellationToken>())) .ReturnsAsync(getReservationResult); var result = await controller.Delete(routeModel); var viewModel = result.Should().BeOfType <ViewResult>() .Which.Model.Should().BeOfType <DeleteViewModel>().Subject; viewModel.Should().BeEquivalentTo(new DeleteViewModel(getReservationResult)); }
public async Task Then_Gets_List_Of_Reservations_From_Search( ReservationsRouteModel routeModel, ManageReservationsFilterModel filterModel, SearchReservationsResult searchResult, [Frozen] Mock <IMediator> mockMediator, ManageReservationsController controller) { mockMediator .Setup(mediator => mediator.Send(It.IsAny <SearchReservationsQuery>(), It.IsAny <CancellationToken>())) .ReturnsAsync(searchResult); await controller.ProviderManage(routeModel, filterModel); mockMediator.Verify(mediator => mediator.Send( It.Is <SearchReservationsQuery>(query => query.ProviderId == routeModel.UkPrn), It.IsAny <CancellationToken>()), Times.Once); }
public async Task Then_Returns_List_Of_Reservations_From_Mediator( [Frozen] ReservationsRouteModel routeModel, ManageReservationsFilterModel filterModel, SearchReservationsResult searchResult, string hashedId, string homeLink, [Frozen] ReservationsWebConfiguration config, [Frozen] Mock <IExternalUrlHelper> externalUrlHelper, [Frozen] Mock <IEncodingService> mockEncodingService, [Frozen] Mock <IMediator> mockMediator, ManageReservationsController controller) { mockMediator .Setup(mediator => mediator.Send(It.IsAny <SearchReservationsQuery>(), It.IsAny <CancellationToken>())) .ReturnsAsync(searchResult); mockEncodingService .Setup(service => service.Encode(It.IsAny <long>(), EncodingType.PublicAccountLegalEntityId)) .Returns(hashedId); externalUrlHelper .Setup(x => x.GenerateDashboardUrl(routeModel.EmployerAccountId)).Returns(homeLink); var expectedReservations = new List <ReservationViewModel>(); expectedReservations.AddRange(searchResult.Reservations.Select(reservation => new ReservationViewModel(reservation, config.ApprenticeUrl, routeModel.UkPrn))); var result = await controller.ProviderManage(routeModel, filterModel) as ViewResult; result.Should().NotBeNull(); result.ViewName.Should().Be(ViewNames.ProviderManage); var viewModel = result.Model as ManageViewModel; viewModel.Should().NotBeNull(); viewModel.TotalReservationCount.Should().Be(searchResult.TotalReservationsForProvider); viewModel.BackLink.Should().Be(homeLink); viewModel.FilterModel.NumberOfRecordsFound.Should().Be(searchResult.NumberOfRecordsFound); viewModel.Reservations.Should().BeEquivalentTo(expectedReservations, options => options.ExcludingFields().Excluding(c => c.ApprenticeUrl)); viewModel.FilterModel.EmployerFilters.Should().BeEquivalentTo(searchResult.EmployerFilters); viewModel.FilterModel.CourseFilters.Should().BeEquivalentTo(searchResult.CourseFilters); viewModel.FilterModel.StartDateFilters.Should().BeEquivalentTo(searchResult.StartDateFilters); }
public async Task Then_The_Cached_Search_Is_Deleted_If_Not_From_BackLink_And_New_One_Saved( ReservationsRouteModel routeModel, ManageReservationsFilterModel filterModel, SearchReservationsResult searchResult, [Frozen] Mock <IMediator> mockMediator, [Frozen] Mock <ISessionStorageService <ManageReservationsFilterModelBase> > sessionStorageService, ManageReservationsController controller) { routeModel.IsFromManage = false; mockMediator .Setup(mediator => mediator.Send(It.Is <SearchReservationsQuery>(c => c.Filter.SearchTerm.Equals(filterModel.SearchTerm)), It.IsAny <CancellationToken>())) .ReturnsAsync(searchResult); await controller.ProviderManage(routeModel, filterModel); mockMediator.Verify(x => x.Send(It.Is <SearchReservationsQuery>( c => c.Filter.SearchTerm.Equals(filterModel.SearchTerm)), It.IsAny <CancellationToken>()), Times.Once); sessionStorageService.Verify(x => x.Delete(), Times.Once); sessionStorageService.Verify(x => x.Store(filterModel)); }
public async Task Add_Apprentice_Url_UkPrn_Will_Be_Populated_From_RouteModel_Reservation( ReservationsRouteModel routeModel, ManageReservationsFilterModel filterModel, SearchReservationsResult searchResult, string hashedId, string expectedUrl, [Frozen] Mock <IEncodingService> mockEncodingService, [Frozen] Mock <IMediator> mockMediator, [Frozen] Mock <IExternalUrlHelper> mockUrlHelper, ManageReservationsController controller) { mockMediator .Setup(mediator => mediator.Send(It.IsAny <SearchReservationsQuery>(), It.IsAny <CancellationToken>())) .ReturnsAsync(searchResult); mockEncodingService .Setup(service => service.Encode(It.IsAny <long>(), EncodingType.PublicAccountLegalEntityId)) .Returns(hashedId); mockUrlHelper.Setup(h => h.GenerateAddApprenticeUrl( It.IsAny <Guid>(), hashedId, It.IsAny <string>(), routeModel.UkPrn, It.IsAny <DateTime>(), routeModel.CohortReference, routeModel.EmployerAccountId, false, "", "")) .Returns(expectedUrl); var result = await controller.ProviderManage(routeModel, filterModel) as ViewResult; var viewModel = result?.Model as ManageViewModel; viewModel.Should().NotBeNull(); viewModel.Reservations.Where(model => model.Status == ReservationStatusViewModel.Pending && !model.IsExpired) .All(c => c.ApprenticeUrl.Equals(expectedUrl)).Should().BeTrue(); }
public async Task And_Has_Ukprn_And_Reservation_From_Different_Provider_Then_Not_Deletable( [Frozen] ReservationsRouteModel routeModel, GetTrustedEmployersResponse getTrustedEmployersResponse, GetReservationsResult getReservationResultDifferentProvider, [ReservationsFromThisProvider] GetReservationsResult getReservationsResult1, [ReservationsFromThisProvider] GetReservationsResult getReservationsResult2, string hashedId, [Frozen] Mock <IEncodingService> mockEncodingService, [Frozen] Mock <IMediator> mockMediator, ManageReservationsController controller) { mockMediator .Setup(mediator => mediator.Send(It.IsAny <GetTrustedEmployersQuery>(), It.IsAny <CancellationToken>())) .ReturnsAsync(getTrustedEmployersResponse); mockMediator .SetupSequence(mediator => mediator.Send(It.IsAny <GetReservationsQuery>(), It.IsAny <CancellationToken>())) .ReturnsAsync(getReservationsResult1) .ReturnsAsync(getReservationsResult2) .ReturnsAsync(getReservationResultDifferentProvider); mockEncodingService .Setup(service => service.Encode(It.IsAny <long>(), EncodingType.PublicAccountLegalEntityId)) .Returns(hashedId); var result = await controller.Manage(routeModel) as ViewResult; var viewModel = result.Model as ManageViewModel; var nonDeletableReservationIds = getReservationResultDifferentProvider.Reservations .Select(reservation => reservation.Id); viewModel.Reservations .Where(model => nonDeletableReservationIds.Contains(model.Id)) .Select(model => model.CanProviderDeleteReservation) .Should().AllBeEquivalentTo(false); viewModel.Reservations .Where(model => !nonDeletableReservationIds.Contains(model.Id)) .Select(model => model.CanProviderDeleteReservation) .Should().AllBeEquivalentTo(true); }
public async Task Then_Gets_List_Of_Reservations_For_Single_Employer_Account( ReservationsRouteModel routeModel, GetReservationsResult getReservationsResult, long decodedAccountId, [Frozen] Mock <IEncodingService> mockEncodingService, [Frozen] Mock <IMediator> mockMediator, ManageReservationsController controller) { mockMediator .Setup(mediator => mediator.Send(It.IsAny <GetReservationsQuery>(), It.IsAny <CancellationToken>())) .ReturnsAsync(getReservationsResult); mockEncodingService .Setup(service => service.Decode(routeModel.EmployerAccountId, EncodingType.AccountId)) .Returns(decodedAccountId); await controller.EmployerManage(routeModel); mockMediator.Verify(mediator => mediator.Send( It.Is <GetReservationsQuery>(query => query.AccountId == decodedAccountId), It.IsAny <CancellationToken>()), Times.Once); }
public async Task And_Reservation_From_This_Provider_Then_Is_Deletable( [Frozen] ReservationsRouteModel routeModel, ManageReservationsFilterModel filterModel, [ReservationsFromThisProvider] SearchReservationsResult searchResult, string hashedId, [Frozen] Mock <IEncodingService> mockEncodingService, [Frozen] Mock <IMediator> mockMediator, ManageReservationsController controller) { mockMediator .Setup(mediator => mediator.Send(It.IsAny <SearchReservationsQuery>(), It.IsAny <CancellationToken>())) .ReturnsAsync(searchResult); mockEncodingService .Setup(service => service.Encode(It.IsAny <long>(), EncodingType.PublicAccountLegalEntityId)) .Returns(hashedId); var result = await controller.ProviderManage(routeModel, filterModel) as ViewResult; var viewModel = result.Model as ManageViewModel; viewModel.Reservations .Select(model => model.CanProviderDeleteReservation) .Should().AllBeEquivalentTo(true); }
public async Task Then_The_Cached_Search_Is_Not_Loaded_If_Null_From_BackLink( ReservationsRouteModel routeModel, ManageReservationsFilterModel filterModel, SearchReservationsResult searchResult, ManageReservationsFilterModelBase baseFilterModel, [Frozen] Mock <IMediator> mockMediator, [Frozen] Mock <ISessionStorageService <ManageReservationsFilterModelBase> > sessionStorageService, ManageReservationsController controller) { filterModel.SearchTerm = string.Empty; routeModel.IsFromManage = true; mockMediator .Setup(mediator => mediator.Send(It.Is <SearchReservationsQuery>(c => c.Filter.SearchTerm.Equals(filterModel.SearchTerm)), It.IsAny <CancellationToken>())) .ReturnsAsync(searchResult); sessionStorageService.Setup(x => x.Get()).Returns((ManageReservationsFilterModelBase)null); await controller.ProviderManage(routeModel, filterModel); mockMediator.Verify(x => x.Send(It.Is <SearchReservationsQuery>( c => c.Filter.SearchTerm.Equals(filterModel.SearchTerm) ), It.IsAny <CancellationToken>()), Times.Once); routeModel.IsFromManage = false; }