Exemple #1
0
        public When_ProviderVenue_Add_Venue_Does_Not_Exist()
        {
            _providerVenueService = Substitute.For <IProviderVenueService>();
            _providerVenueService.IsValidPostcodeAsync("CV1 2WT").Returns((true, "CV1 2WT"));
            _providerVenueService.GetVenueAsync(1, "CV1 2WT").ReturnsNull();
            _providerVenueService.CreateVenueAsync(Arg.Any <AddProviderVenueViewModel>()).Returns(1);

            var providerVenueController = new ProviderVenueController(_providerVenueService);
            var controllerWithClaims    = new ClaimsBuilder <ProviderVenueController>(providerVenueController)
                                          .AddUserName("username")
                                          .AddEmail("*****@*****.**")
                                          .Build();

            var viewModel = new AddProviderVenueViewModel
            {
                ProviderId = 1,
                Postcode   = "CV1 2WT"
            };

            _result = controllerWithClaims.CreateVenueAsync(viewModel).GetAwaiter().GetResult();
        }