protected override void Establish_context() { ConfigurationProvider = Create.New.StubbedEventPluginConfiguration().Build(); MockRepository.GenerateMock <IEventPluginConfigurationProvider>(); _settings = MockRepository.GenerateMock <IGraffitiSiteSettings>(); _settings.Stub(x => x.Title).Return("The site's title"); _sut = new CalendarItemRepository(ConfigurationProvider, _settings); _settings.Stub(x => x.BaseUrl).Return("http://foo"); }
public EventPluginMemento(IEventPluginConfigurationProvider source) { SpeakerField = source.SpeakerField; EndDateField = source.EndDateField; LocationField = source.LocationField; StartDateField = source.StartDateField; LocationUnknownField = source.LocationUnknownField; RegistrationNeededField = source.RegistrationNeededField; RegistrationRecipientField = source.RegistrationRecipientField; MaximumNumberOfRegistrationsField = source.MaximumNumberOfRegistrationsField; RegistrationListField = source.RegistrationListField; CategoryName = source.CategoryName; EarliestRegistrationField = source.EarliestRegistrationField; LatestRegistrationField = source.LatestRegistrationField; }
public EventValidator(IEventPluginConfigurationProvider config) { RequireValidDateRangeWithOptionalValues(config.StartDateField, config.EndDateField); If(x => x[config.EndDateField].HasValue() && !x[config.StartDateField].HasValue()) .AddNotification(EventErrors.StartDateIsRequiredWhenEndDateIsSet(config.StartDateField)); RequireValidDateRangeWithOptionalValues(config.EarliestRegistrationField, config.LatestRegistrationField); If(x => x[config.MaximumNumberOfRegistrationsField].HasValue() && !x[config.MaximumNumberOfRegistrationsField].ToInt(int.MinValue).IsInRange(0, int.MaxValue)) .AddNotification( EventErrors.MaximumNumberOfRegistrationsMustBeEqualOrGreaterThanZero(config.MaximumNumberOfRegistrationsField)); If(x => x[config.RegistrationRecipientField].HasValue() && !x[config.RegistrationRecipientField].IsEmail()) .AddNotification(EventErrors.InvalidRegistrationRecipientEmail(config.RegistrationRecipientField)); }
public EventBuilder(IEventPluginConfigurationProvider configurationProvider) { _config = configurationProvider; }
protected override void Establish_context() { ConfigurationProvider = Create.New.StubbedEventPluginConfiguration().Build(); MockRepository.GenerateMock<IEventPluginConfigurationProvider>(); _settings = MockRepository.GenerateMock<IGraffitiSiteSettings>(); _settings.Stub(x => x.Title).Return("The site's title"); _sut = new CalendarItemRepository(ConfigurationProvider, _settings); _settings.Stub(x => x.BaseUrl).Return("http://foo"); }
public CalendarItemRepository(IEventPluginConfigurationProvider eventPluginConfigurationProvider, IGraffitiSiteSettings settings) { _eventPluginConfigurationProvider = eventPluginConfigurationProvider; _settings = settings; }