示例#1
0
        public async Task ServiceProvider_ShouldCreateNewServiceProviderAsync()
        {
            // Assemble
            var context = new ApplicationContext(DbAssembly().Options);
            var serviceProviderController = new ServiceProviderController(context, new AppointmentBookingService());
            var serviceProvider           = (new ServiceProvider());

            // Act
            await serviceProviderController.Create(serviceProvider);

            // Assert
            Assert.NotEmpty(context.ServiceProviders);
        }
        public void ServiceProvider_ShouldAddNewServiceProvider()
        {
            // Assemble
            var mockRepository  = new MyMockedRepository();
            var serviceProvider = new ServiceProvider
            {
                FirstName = "Jane",
                LastName  = "Doe"
            };
            ServiceProviderController controller = new ServiceProviderController(mockRepository);

            // Act
            controller.Create(serviceProvider);

            // Assert
            Assert.NotEmpty(mockRepository.ServiceProviders);
        }