Exemplo n.º 1
0
        public void CreateAppointment_NullStaff_ThrowsArgumentException()
        {
            var appointmentRepository = new Mock<IAppointmentRepository> ();
            var appointmentFactory = new AppointmentFactory (
                appointmentRepository.Object );

            var start = new DateTime ( 2000, 1, 1, 9, 0, 0 );
            var end = new DateTime ( 2000, 1, 1, 10, 0, 0 );

            appointmentFactory.CreateAppointment ( null, new DateTimeRange ( start, end ) );
        }
Exemplo n.º 2
0
        public void CreateAppointment_GivenValidArguments_CreatesAnAppointment()
        {
            var appointmentRepository = new Mock<IAppointmentRepository> ();
            var appointmentFactory = new AppointmentFactory (
                appointmentRepository.Object );

            var staff = new Mock<Staff> ();
            var start = new DateTime ( 2000, 1, 1, 9, 0, 0 );
            var end = new DateTime ( 2000, 1, 1, 10, 0, 0 );

            Appointment appointment = appointmentFactory.CreateAppointment ( staff.Object, new DateTimeRange ( start, end ) );

            Assert.IsNotNull ( appointment );
        }
Exemplo n.º 3
0
        public void CreateAppointment_GivenValidArguments_AppointmentIsEditable()
        {
            using ( var serviceLocatorFixture = new ServiceLocatorFixture () )
            {
                // Setup
                var appointmentRepository = new Mock<IAppointmentRepository> ();
                var appointmentFactory = new AppointmentFactory (
                    appointmentRepository.Object );

                var staff = new Mock<Staff> ();
                var start = new DateTime ( 2000, 1, 1, 9, 0, 0 );
                var end = new DateTime ( 2000, 1, 1, 10, 0, 0 );

                Appointment appointment = appointmentFactory.CreateAppointment ( staff.Object, new DateTimeRange ( start, end ) );

                appointment.ReviseSubjectDescription ( "Some Appointment" );
            }
        }
Exemplo n.º 4
0
        public void CreateAppointment_GivenValidArguments_AppointmentIsPersisted()
        {
            bool isPersisted = false;

            var appointmentRepository = new Mock<IAppointmentRepository> ();
            appointmentRepository
                .Setup ( a => a.MakePersistent ( It.IsAny<Appointment> () ) )
                .Callback ( () => isPersisted = true );
            var appointmentFactory = new AppointmentFactory (
                appointmentRepository.Object );

            var staff = new Mock<Staff> ();
            var start = new DateTime ( 2000, 1, 1, 9, 0, 0 );
            var end = new DateTime ( 2000, 1, 1, 10, 0, 0 );

            appointmentFactory.CreateAppointment ( staff.Object, new DateTimeRange ( start, end ) );

            Assert.IsTrue ( isPersisted );
        }
Exemplo n.º 5
0
        public void DestroyAppointment_GivenAnAppointment_AppointmentIsMadeTransient()
        {
            bool isTransient = false;

            var appointmentRepository = new Mock<IAppointmentRepository> ();
            appointmentRepository
                .Setup ( a => a.MakeTransient ( It.IsAny<Appointment> () ) )
                .Callback ( () => isTransient = true );
            var appointmentFactory = new AppointmentFactory (
                appointmentRepository.Object );

            var appointment = new Mock<Appointment> ();

            appointmentFactory.DestroyAppointment ( appointment.Object );

            Assert.IsTrue ( isTransient );
        }