public void Test_NotAuthorizedResult()
        {
            var helper = new ViewHelper(Views.Forbidden);
            var result = new NotAuthorizedResult { ViewEngineCollection = helper.ViewEngineCollection };

            result.ExecuteResult(helper.ControllerContext);

            Assert.AreEqual(Views.Forbidden, result.ViewName, "ViewName");
            Assert.IsInstanceOf(typeof(StatusViewModel), result.Model, "Model");
        }
        public void Initialize()
        {
            var controller = new SearchController(new FakeUserSearchService());
            var helper = new ViewHelper();

            controller.ControllerContext = helper.ControllerContext;
            controller.Url = helper.UrlHelper;

            this.SearchController = controller;
        }
Example #3
0
        public void Test_StatusResult()
        {
            var helper = new ViewHelper(Views.Status);
            var result = new StatusResult("test") { ViewEngineCollection = helper.ViewEngineCollection };

            result.ExecuteResult(helper.ControllerContext);

            Assert.AreEqual("test", result.Message, "Message");
            Assert.AreEqual(Views.Status, result.ViewName, "ViewName");
            Assert.IsInstanceOf(typeof(StatusViewModel), result.Model, "Model");
        }
        public void Initialize()
        {
            IKernel kernel = new StandardKernel();

            kernel.Load(new TestModule());

            ServiceLocator.SetLocatorProvider(() => new NinjectServiceLocator(kernel));

            var controller = new HostSearchController(new FakeUserHostSearchService());
            var helper = new ViewHelper();

            controller.ControllerContext = helper.ControllerContext;
            controller.Url = helper.UrlHelper;

            this.HostSearchController = controller;
        }
        public void Initialize()
        {
            IKernel kernel = new StandardKernel();

            kernel.Load(new TestModule());

            ServiceLocator.SetLocatorProvider(() => new NinjectServiceLocator(kernel));

            var userService = MockRepository.GenerateMock<IUserService>();
            var controller = new AvatarController(userService, new FakeUserAvatarService());
            var helper = new ViewHelper();

            controller.ControllerContext = helper.ControllerContext;
            controller.Url = helper.UrlHelper;

            this.AvatarController = controller;
        }
        public void Initialize()
        {
            IKernel kernel = new StandardKernel();

            kernel.Load(new TestModule());

            ServiceLocator.SetLocatorProvider(() => new NinjectServiceLocator(kernel));

            var controller = new CountryController(
                new FakeAuditService<Country, CountryAudit>(),
                new FakeCountryService()
            );

            var helper = new ViewHelper();

            controller.ControllerContext = helper.ControllerContext;
            controller.Url = helper.UrlHelper;

            this.CountryController = controller;
        }
Example #7
0
        public void Initialize()
        {
            IKernel kernel = new StandardKernel();

            kernel.Load(new TestModule());

            ServiceLocator.SetLocatorProvider(() => new NinjectServiceLocator(kernel));

            var service = MockRepository.GenerateMock<IUserService>();

            service.Stub(x => x.GetById(1)).Return(new User { EmailAddress = "test" });
            service.Stub(x => x.GetBy(new UserEmailAddressSpecification("test"))).Return(new User { EmailAddress = "*****@*****.**" });

            var controller = new AuthController(service);
            var helper = new ViewHelper();

            controller.ControllerContext = helper.ControllerContext;
            controller.Url = helper.UrlHelper;

            this.AuthController = controller;
        }
Example #8
0
 public void Initialize()
 {
     this.Helper = new ViewHelper();
 }
Example #9
0
        public void Test_HomeController_Create_Post()
        {
            var value = new UserCreate
            {
                Name = "fake",
                EmailAddress = "*****@*****.**",
                VerifyEmailAddress = "*****@*****.**",
                Password = "******",
                VerifyPassword = "******"
            };

            var statusResult = this.HomeController.Create(value) as StatusResult;

            Assert.IsNotNull(statusResult, "StatusResult");

            var helper = new ViewHelper(Views.Status);

            statusResult.ViewEngineCollection = helper.ViewEngineCollection;
            statusResult.ExecuteResult(helper.ControllerContext);

            Assert.AreEqual(Messages.UserAccountCreated, statusResult.Message, "Message");

            value.Name = string.Empty;

            var errorResult = this.HomeController.Create(value) as ViewResult;

            Assert.IsNotNull(errorResult, "ErrorResult");
            Assert.AreEqual(Views.Create, errorResult.ViewName, "ErrorViewName");
            Assert.AreEqual(3, value.Errors.Count, "Errors");
        }
Example #10
0
        public void Test_AuthController_Reset_Post()
        {
            var value = new UserAuthenticationReset
            {
                EmailAddress = "*****@*****.**"
            };

            var statusResult = this.AuthController.Reset(value) as StatusResult;

            Assert.IsNotNull(statusResult, "StatusResult");

            var helper = new ViewHelper(Views.Status);

            statusResult.ViewEngineCollection = helper.ViewEngineCollection;
            statusResult.ExecuteResult(helper.ControllerContext);

            Assert.AreEqual(Messages.UserAccountPasswordReset, statusResult.Message, "Message");
        }