예제 #1
0
        public void GarageFacroty_ShowAvailableAppointments_Return_error_Message_When_Throws_Exception_Cheking_File()
        {
            _mockCommon.Setup(fake => fake.ListAppointmentBookedPerDay(It.IsAny <string>(), It.IsAny <int>())).Throws(new Exception());
            var           garage     = new PlainTextSource(_mockCommon.Object, null);
            PrivateObject maxDaysObj = new PrivateObject(garage);

            maxDaysObj.SetField("maxNextDays", 1);
            var result = garage.ShowAvailableAppointments();
            var errorMessageAspected = "There is a fatal error in the file";

            Assert.AreEqual(true, result.StartsWith(errorMessageAspected));
        }
예제 #2
0
        public void GarageFacroty_ShowAvailableAppointments_Return_Valid_Message_When_No_Appoinments_Booked_Today()
        {
            var listBookedAppointments = new Dictionary <DateTime, List <BookingModel> >();
            var textListAppointment    = "All mechanics are avaialble in this day";

            _mockCommon.Setup(fake => fake.ListAppointmentBookedPerDay(It.IsAny <string>(), It.IsAny <int>())).Returns(new List <BookingModel>());
            _mockCommon.Setup(fake => fake.ShowFreeTimeNextTenDays(It.IsAny <Dictionary <DateTime, List <BookingModel> > >(), It.IsAny <string>(), It.IsAny <string>())).Returns(textListAppointment);
            var garage = new PlainTextSource(_mockCommon.Object, null);
            var result = garage.ShowAvailableAppointments();
            var appoinentAvailableAspected = "All mechanics are avaialble in this day";

            Assert.AreEqual(true, result.Contains(appoinentAvailableAspected));
        }