コード例 #1
0
        public void CannotSubmitASession_WhenSessionSubmissionIsClosed()
        {
            var controller = new SessionControllerBuilder().Build();

            var result = controller.Create(new Session());

            Assert.That(result, Is.InstanceOf<HttpUnauthorizedResult>());
        }
コード例 #2
0
        public void CannotSeeSessionList_WhenTheConferenceSaysThatSessionsCannotBeShown()
        {
            var controller = new SessionControllerBuilder().Build();

            var result = controller.Index();

            Assert.That(result, Is.InstanceOf<HttpNotFoundResult>());
        }
コード例 #3
0
        public void CannotSaveAnEditToASession_WhenTheSessionBelongsToAnotherUser()
        {
            var session = new Session { SessionId = 1, SpeakerUserName = "******" };
            var controller = new SessionControllerBuilder().Updating(session).Build();

            var result = controller.Edit("fred", session);

            Assert.That(result, Is.InstanceOf<HttpUnauthorizedResult>());
        }
コード例 #4
0
        public void ShouldEmailTheUserTheirSubmission_WhenCreating()
        {
            var postman = Substitute.For<IPostman>();
            var bob = new UserProfile { Name = "Bob", EmailAddress = "*****@*****.**", UserName = "******" };
            var session = new Session
            {
                Title = "Bob's awesome session",
                Abstract = "This is going to be awesome!"
            };

            var controller = new SessionControllerBuilder()
                .WithPostman(postman)
                .WhenSubmissionsAreOpen()
                .ForUser(bob)
                .Submitting(session)
                .Build();

            controller.Create(session);

            var expectedMailMessage = MailMessage.FromTemplate(SessionCreatedMailTemplate.Create(session), bob);
            postman.Received().Deliver(expectedMailMessage);
        }
コード例 #5
0
        public void ShouldEmailTheUserTheirUpdatedSubmission_WhenEditing()
        {
            var postman = Substitute.For<IPostman>();
            var bob = new UserProfile { Name = "Bob", EmailAddress = "*****@*****.**", UserName = "******" };
            var session = new Session
            {
                Title = "Bob's even more awesome session",
                Abstract = "Just wait until you see it!",
                SpeakerUserName = bob.UserName,
                SessionId = 1
            };

            var controller = new SessionControllerBuilder()
                .WithPostman(postman)
                .ForUser(bob)
                .Updating(session)
                .Build();

            controller.Edit(bob.UserName, session);

            var expectedMailMessage = MailMessage.FromTemplate(SessionUpdatedMailTemplate.Create(session), bob);
            postman.Received().Deliver(expectedMailMessage);
        }