コード例 #1
0
        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);
        }
コード例 #2
0
        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];
        }
コード例 #3
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;
 }
コード例 #4
0
        public SubmissionViewModel(User speaker, CallForSpeakers callForSpeakers)
        {
            CallForSpeakers = callForSpeakers;
            CallForSpeakersId = callForSpeakers.Id;

            SpeakerName = speaker.Name;
            SpeakerEmail = speaker.Email;
            SpeakerTwitter = speaker.Twitter;
            SpeakerImageUrl = speaker.ImageUrl;
        }
コード例 #5
0
        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);
        }
コード例 #6
0
ファイル: Submission.cs プロジェクト: calebjenkins/speakerio
        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;
        }
コード例 #7
0
ファイル: Submission.cs プロジェクト: calebjenkins/speakerio
        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;
        }
コード例 #8
0
        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");
        }
コード例 #9
0
        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);
        }
コード例 #10
0
        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);
        }
コード例 #11
0
 public void When_setting_last_day_with_null()
 {
     var model = new CallForSpeakers();
     model.SetLastDayToSubmit(null);
     model.LastDayToSubmitUtc.ShouldBeNull();
 }