public void ClientAsksCalendarService() { int year = 2009; int month = 2; string townCode = "b002"; ICalendarServie serviceMock = MockRepository.GenerateStrictMock <ICalendarServie>(); serviceMock.Expect( x => x.GetHolidays( year, month, townCode)).Return(new int[] { 1, 5 }); Calendar calendar = new Calendar(serviceMock); calendar.CurrentTown = townCode; calendar.CurrentYear = year; calendar.CurrentMonth = month; calendar.DrawMonth(); // the SUT serviceMock.VerifyAllExpectations(); }
public void DrawHolidaysWithStub() { int year = 2009; int month = 2; string townCode = "b002"; ICalendarServie serviceStub = MockRepository.GenerateStub <ICalendarServie>(); serviceStub.Stub( x => x.GetHolidays(year, month, townCode)).Return( new int[] { 1, 5 }); Calendar calendar = new Calendar(serviceStub); calendar.CurrentTown = townCode; calendar.CurrentYear = year; calendar.CurrentMonth = month; calendar.DrawMonth(); Assert.AreEqual(1, calendar.Holidays[0]); Assert.AreEqual(1, calendar.Holidays[1]); }
public Calendar(ICalendarServie calendarService) { this.calendarService = calendarService; }