public async Task UploadProviderVersion_CallsCorrectly( string providerVersionId) { IProviderVersionService providerVersionService = Substitute.For <IProviderVersionService>(); IProviderVersionSearchService providerVersionSearchService = Substitute.For <IProviderVersionSearchService>(); ProviderVersionViewModel providers = new ProviderVersionViewModel(); ProviderByVersionController controller = new ProviderByVersionController( providerVersionService, providerVersionSearchService); controller.ControllerContext = new Microsoft.AspNetCore.Mvc.ControllerContext() { RouteData = new Microsoft.AspNetCore.Routing.RouteData ( new Microsoft.AspNetCore.Routing.RouteValueDictionary ( new Dictionary <string, string>() { { "controller", "ProviderByVersion" } } ) ) }; await controller.UploadProviderVersion(providerVersionId, providers); await providerVersionService .Received(1) .UploadProviderVersion("GetProvidersByVersion", "ProviderByVersion", providerVersionId, providers); }
public async Task GetProvidersByVersion_CallsCorrectly(int year, int month, int day) { IProviderVersionService providerVersionService = Substitute.For <IProviderVersionService>(); IProviderVersionSearchService providerVersionSearchService = Substitute.For <IProviderVersionSearchService>(); ProviderByDateController controller = new ProviderByDateController( providerVersionService, providerVersionSearchService); await controller.GetProvidersByVersion(year, month, day); await providerVersionService .Received(1) .GetAllProviders(year, month, day); }
public async Task DoesProviderVersionExist_CallsCorrectly( string providerVersionId) { IProviderVersionService providerVersionService = Substitute.For <IProviderVersionService>(); IProviderVersionSearchService providerVersionSearchService = Substitute.For <IProviderVersionSearchService>(); ProviderByVersionController controller = new ProviderByVersionController( providerVersionService, providerVersionSearchService); await controller.DoesProviderVersionExist(providerVersionId); await providerVersionService .Received(1) .DoesProviderVersionExist(providerVersionId); }
public async Task GetProvidersByVersion_CallsCorrectly( string providerVersionId) { IProviderVersionService providerVersionService = Substitute.For <IProviderVersionService>(); IProviderVersionSearchService providerVersionSearchService = Substitute.For <IProviderVersionSearchService>(); ProviderByVersionController controller = new ProviderByVersionController( providerVersionService, providerVersionSearchService); await controller.GetProvidersByVersion(providerVersionId); await providerVersionService .Received(1) .GetAllProviders(providerVersionId); }
public async Task SetProviderDateProviderVersion_CallsCorrectly(int year, int month, int day) { IProviderVersionService providerVersionService = Substitute.For <IProviderVersionService>(); IProviderVersionSearchService providerVersionSearchService = Substitute.For <IProviderVersionSearchService>(); providerVersionService .GetAllProviders(Arg.Any <string>()) .Returns(new OkObjectResult(new Provider { ProviderVersionId = "providerVersionId" })); ProviderByDateController controller = Substitute.For <ProviderByDateController>(providerVersionService, providerVersionSearchService); await controller.SetProviderDateProviderVersion(year, month, day, "providerVersionId"); await providerVersionService .Received(1) .SetProviderVersionByDate(Arg.Any <int>(), Arg.Any <int>(), Arg.Any <int>(), Arg.Any <string>()); }