Пример #1
0
        public void Repository_ShouldBookAppointments()
        {
            // Assemble
            var mockRepository = new MyMockedRepository();
            var customer       = new Customer
            {
                FirstName = "Jane",
                LastName  = "Doe"
            };

            mockRepository.AddCustomer(customer);

            var serviceProvider = new ServiceProvider
            {
                FirstName = "John",
                LastName  = "Doe"
            };

            mockRepository.AddServiceProvider(serviceProvider);

            var appointment = new Appointment
            {
                CustomerFullName        = customer.FullName,
                ServiceProviderFullName = serviceProvider.FullName,
                Service = 0,
                Day     = 0,
                Time    = 0
            };

            // Act
            mockRepository.BookAppointment(appointment);

            // Assert
            Assert.NotEmpty(mockRepository.Appointments);
        }
Пример #2
0
        public void Customer_ShouldAddNewCustomer()
        {
            // Assemble
            var mockRepository = new MyMockedRepository();
            var customer       = new Customer
            {
                FirstName = "Jane",
                LastName  = "Doe"
            };
            CustomerController controller = new CustomerController(mockRepository);

            // Act
            controller.Create(customer);

            // Assert
            Assert.NotEmpty(mockRepository.Customers);
        }
Пример #3
0
        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);
        }
Пример #4
0
        public void Appointment_ShouldDeleteAppointment()
        {
            // Assemble
            var mockRepository = new MyMockedRepository();
            var appointment    = new Appointment
            {
                CustomerFullName        = "Jane Doe",
                ServiceProviderFullName = "John Doe",
                Day  = 0,
                Time = 0
            };

            mockRepository.AddAppointment(appointment);
            AppointmentController controller = new AppointmentController(mockRepository);

            // Act
            controller.Delete(appointment);

            // Assert
            Assert.Empty(mockRepository.Appointments);
        }