public void CannotSubmitASession_WhenSessionSubmissionIsClosed() { var controller = new SessionControllerBuilder().Build(); var result = controller.Create(new Session()); Assert.That(result, Is.InstanceOf<HttpUnauthorizedResult>()); }
public void CannotSeeSessionList_WhenTheConferenceSaysThatSessionsCannotBeShown() { var controller = new SessionControllerBuilder().Build(); var result = controller.Index(); Assert.That(result, Is.InstanceOf<HttpNotFoundResult>()); }
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>()); }
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); }
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); }