Esempio n. 1
0
        public async Task Template_ShouldSuccessfullyReturnViewResultWhenInPreviewMode()
        {
            var engine     = new Mock <IViewRenderService>().Object;
            var controller = new EmailTemplateController(engine);

            var result = await controller.Template("", new ResetPasswordModel { Preview = true });

            Assert.IsInstanceOfType(result, typeof(ViewResult));
        }
Esempio n. 2
0
        public async Task Template_ShouldSuccessfullyReturnStringContent()
        {
            var engine = new Mock <IViewRenderService>();

            engine.Setup(e => e.RenderToString(It.IsAny <string>(), It.IsAny <EmailTemplateModel>()))
            .ReturnsAsync("TEST");

            var controller = new EmailTemplateController(engine.Object);

            var result = await controller.Template("", new ResetPasswordModel { Preview = false }) as OkObjectResult;

            Assert.IsNotNull(result);
            Assert.IsInstanceOfType(result, typeof(OkObjectResult));
            Assert.AreEqual(result.StatusCode, (int)HttpStatusCode.OK);
            Assert.AreEqual("TEST", result.Value);
        }