public void Should_map_from_entity() { var user = new User("foo"); var entity = new CallForSpeakers { Description = "description", EventName = "event name", FirstDayOfEvent = new DateTime(2001,1,2), Id = 123, LastDayOfEvent = new DateTime(2001,1,3), LastDayToSubmit = new DateTime(2001,1,4), LogoUrl = "logo url", Slug = "asdasd", Organizer = user }; var input = new CallForSpeakersInput(entity); input.Description.ShouldEqual(entity.Description); input.EventName.ShouldEqual(entity.EventName); input.FirstDayOfEvent.ShouldEqual(entity.FirstDayOfEvent); input.Id.ShouldEqual(entity.Id); input.LastDayOfEvent.ShouldEqual(entity.LastDayOfEvent); input.LastDayToSubmit.ShouldEqual(entity.LastDayToSubmit); input.LogoUrl.ShouldEqual(entity.LogoUrl); }
public void When_sending_a_rejection_email() { var email = S<IEmailService>(); var organizer = new User("organizer") { Email = "*****@*****.**" }; var callForSpeakers = new CallForSpeakers { Organizer = organizer, EventName = "event" }; var speaker = new User("foo") { Email = "*****@*****.**" }; var submission = new Submission(speaker, new SubmissionViewModel {Title = "title"}, callForSpeakers) { RejectionReason = "rejection reason" }; var sender = new DomainEmailSender(email); sender.SubmissionRejection(submission); emailMessage = (EmailMessage) email.GetArgumentsForCallsMadeOn(x => x.Send(null))[0][0]; }
public CallForSpeakersInput(CallForSpeakers found) { EventName = found.EventName; Description = found.Description; FirstDayOfEvent = found.FirstDayOfEvent; LastDayOfEvent = found.LastDayOfEvent; LastDayToSubmit = found.LastDayToSubmit; LogoUrl = found.LogoUrl; Id = found.Id; }
public SubmissionViewModel(User speaker, CallForSpeakers callForSpeakers) { CallForSpeakers = callForSpeakers; CallForSpeakersId = callForSpeakers.Id; SpeakerName = speaker.Name; SpeakerEmail = speaker.Email; SpeakerTwitter = speaker.Twitter; SpeakerImageUrl = speaker.ImageUrl; }
public void When_setting_last_day_to_submit_nullable() { var utcDate = (DateTime?) new DateTime(2012, 12, 12, 12, 12, 12, 12, DateTimeKind.Utc); DateTime localDate = utcDate.Value.ToLocalTime(); var model = new CallForSpeakers(); model.SetLastDayToSubmit(localDate); model.LastDayToSubmitUtc.Value.ShouldEqual(utcDate.Value.Date); }
public Submission(User submitter, SubmissionViewModel input, CallForSpeakers callForSpeakers) { Submitter = submitter; CallForSpeakers = callForSpeakers; Title = input.Title; Abstract = input.Abstract; Status = Submitted; SpeakerName = input.SpeakerName; SpeakerBio = input.SpeakerBio; SpeakerEmail = input.SpeakerEmail; SpeakerPhone = input.SpeakerPhone; SpeakerTwitter = input.SpeakerTwitter; SpeakerImageUrl = input.SpeakerImageUrl; }
public void Should_generate_unique_url_key() { var input = new CallForSpeakersInput { Description = "description", EventName = "event name", LastDayToSubmit = new DateTime(2001, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), FirstDayOfEvent = new DateTime(2001, 2, 1, 0, 0, 0, 0, DateTimeKind.Utc), LastDayOfEvent = new DateTime(2001, 3, 1, 0, 0, 0, 0, DateTimeKind.Utc), LogoUrl = "logo url" }; var call = new CallForSpeakers(input); call.Slug.ShouldEqual("event-name-2001-02-01"); }
public void Should_truncate_large_key() { var input = new CallForSpeakersInput { Description = "description", EventName = "1234567890123456789012345678901234567890", LastDayToSubmit = new DateTime(2001, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), FirstDayOfEvent = new DateTime(2001, 2, 1, 0, 0, 0, 0, DateTimeKind.Utc), LastDayOfEvent = new DateTime(2001, 3, 1, 0, 0, 0, 0, DateTimeKind.Utc), LogoUrl = "logo url" }; var call = new CallForSpeakers(input); call.Slug.ShouldEqual("12345678901234567890123456-2001-02-01"); call.Slug.Length.ShouldBeInRange(1, 40); }
public void When_initializing_data_entity_from_user_input() { var input = new CallForSpeakersInput { Description = "description", EventName = "event name", LastDayToSubmit = new DateTime(2001, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), LogoUrl = "logo url" }; var model = new CallForSpeakers(input); model.Description.ShouldEqual(input.Description); model.EventName.ShouldEqual(input.EventName); model.LastDayToSubmitUtc.ShouldEqual(input.LastDayToSubmit); model.LogoUrl.ShouldEqual(input.LogoUrl); }
public void When_setting_last_day_with_null() { var model = new CallForSpeakers(); model.SetLastDayToSubmit(null); model.LastDayToSubmitUtc.ShouldBeNull(); }