private Get ( System.Guid token, string secretCode ) : System.Web.Mvc.ActionResult | ||
token | System.Guid | |
secretCode | string | |
리턴 | System.Web.Mvc.ActionResult |
public void SetsModelProperty_IsUrlConfirmation_ToTrue_WhenMethodArgIsNotNullOrWhiteSpace() { var confirmation = new EmailConfirmation(EmailConfirmationIntent.ResetPassword) { SecretCode = "very secret", }; const string secretCode = "not as secret"; var queryProcessor = new Mock <IProcessQueries>(MockBehavior.Strict); queryProcessor.Setup(m => m.Execute(It.Is(ConfirmationQueryBasedOn(confirmation.Token)))) .Returns(confirmation); var services = new ConfirmEmailServices(queryProcessor.Object, null); var controller = new ConfirmEmailController(services); var result = controller.Get(confirmation.Token, secretCode); result.ShouldNotBeNull(); result.ShouldImplement <ViewResultBase>(); var viewResultBase = (ViewResultBase)result; viewResultBase.Model.ShouldNotBeNull(); viewResultBase.Model.ShouldBeType <ConfirmEmailForm>(); var model = (ConfirmEmailForm)viewResultBase.Model; model.SecretCode.ShouldEqual(secretCode); model.SecretCode.ShouldNotEqual(confirmation.SecretCode); model.IsUrlConfirmation.ShouldBeTrue(); }
public void ReturnsView_WhenConfirmation_IsFound() { var confirmation = new EmailConfirmation(EmailConfirmationIntent.CreatePassword); var queryProcessor = new Mock <IProcessQueries>(MockBehavior.Strict); queryProcessor.Setup(m => m.Execute(It.Is(ConfirmationQueryBasedOn(confirmation.Token)))) .Returns(confirmation); var services = new ConfirmEmailServices(queryProcessor.Object, null); var controller = new ConfirmEmailController(services); var result = controller.Get(confirmation.Token, null); result.ShouldNotBeNull(); result.ShouldBeType <ViewResult>(); }
public void Returns404_WhenConfirmation_CannotBeFound() { var token = Guid.NewGuid(); var queryProcessor = new Mock <IProcessQueries>(MockBehavior.Strict); queryProcessor.Setup(m => m.Execute(It.Is(ConfirmationQueryBasedOn(token)))) .Returns(null as EmailConfirmation); var services = new ConfirmEmailServices(queryProcessor.Object, null); var controller = new ConfirmEmailController(services); var result = controller.Get(token, null); result.ShouldNotBeNull(); result.ShouldBeType <HttpNotFoundResult>(); }
public void ExecutesQuery_ForConfirmation() { var token = Guid.NewGuid(); var queryProcessor = new Mock <IProcessQueries>(MockBehavior.Strict); queryProcessor.Setup(m => m.Execute(It.Is(ConfirmationQueryBasedOn(token)))) .Returns(null as EmailConfirmation); var services = new ConfirmEmailServices(queryProcessor.Object, null); var controller = new ConfirmEmailController(services); controller.Get(token, null); queryProcessor.Verify(m => m.Execute( It.Is(ConfirmationQueryBasedOn(token))), Times.Once()); }
public void Returns404_WhenConfirmation_CannotBeFound() { var token = Guid.NewGuid(); var queryProcessor = new Mock<IProcessQueries>(MockBehavior.Strict); queryProcessor.Setup(m => m.Execute(It.Is(ConfirmationQueryBasedOn(token)))) .Returns(null as EmailConfirmation); var services = new ConfirmEmailServices(queryProcessor.Object, null); var controller = new ConfirmEmailController(services); var result = controller.Get(token, null); result.ShouldNotBeNull(); result.ShouldBeType<HttpNotFoundResult>(); }
public void ExecutesQuery_ForConfirmation() { var token = Guid.NewGuid(); var queryProcessor = new Mock<IProcessQueries>(MockBehavior.Strict); queryProcessor.Setup(m => m.Execute(It.Is(ConfirmationQueryBasedOn(token)))) .Returns(null as EmailConfirmation); var services = new ConfirmEmailServices(queryProcessor.Object, null); var controller = new ConfirmEmailController(services); controller.Get(token, null); queryProcessor.Verify(m => m.Execute( It.Is(ConfirmationQueryBasedOn(token))), Times.Once()); }
public void SetsModelProperty_IsUrlConfirmation_ToTrue_WhenMethodArgIsNotNullOrWhiteSpace() { var confirmation = new EmailConfirmation(EmailConfirmationIntent.ResetPassword) { SecretCode = "very secret", }; const string secretCode = "not as secret"; var queryProcessor = new Mock<IProcessQueries>(MockBehavior.Strict); queryProcessor.Setup(m => m.Execute(It.Is(ConfirmationQueryBasedOn(confirmation.Token)))) .Returns(confirmation); var services = new ConfirmEmailServices(queryProcessor.Object, null); var controller = new ConfirmEmailController(services); var result = controller.Get(confirmation.Token, secretCode); result.ShouldNotBeNull(); result.ShouldImplement<ViewResultBase>(); var viewResultBase = (ViewResultBase)result; viewResultBase.Model.ShouldNotBeNull(); viewResultBase.Model.ShouldBeType<ConfirmEmailForm>(); var model = (ConfirmEmailForm)viewResultBase.Model; model.SecretCode.ShouldEqual(secretCode); model.SecretCode.ShouldNotEqual(confirmation.SecretCode); model.IsUrlConfirmation.ShouldBeTrue(); }
public void ReturnsView_WhenConfirmation_IsFound() { var confirmation = new EmailConfirmation(EmailConfirmationIntent.CreatePassword); var queryProcessor = new Mock<IProcessQueries>(MockBehavior.Strict); queryProcessor.Setup(m => m.Execute(It.Is(ConfirmationQueryBasedOn(confirmation.Token)))) .Returns(confirmation); var services = new ConfirmEmailServices(queryProcessor.Object, null); var controller = new ConfirmEmailController(services); var result = controller.Get(confirmation.Token, null); result.ShouldNotBeNull(); result.ShouldBeType<ViewResult>(); }