예제 #1
0
 private static AccountController GetAccountController()
 {
     IFormsAuthentication formsAuth = new MockFormsAuthenticationService();
     MembershipProvider membershipProvider = new MockMembershipProvider();
     AccountMembershipService membershipService = new AccountMembershipService(membershipProvider);
     AccountController controller = new AccountController(formsAuth, membershipService);
     ControllerContext controllerContext = new ControllerContext(new MockHttpContext(), new RouteData(), controller);
     controller.ControllerContext = controllerContext;
     return controller;
 }
예제 #2
0
        public void ConstructorSetsProperties()
        {
            // Arrange
            IFormsAuthentication formsAuth = new MockFormsAuthenticationService();

            // Article3
            IMembershipService membershipService = new AccountMembershipService(Membership.Provider);

            // Act
            AccountController controller = new AccountController(formsAuth, membershipService);

            // Assert
            Assert.AreEqual(formsAuth, controller.FormsAuth, "FormsAuth property did not match.");
            Assert.AreEqual(membershipService, controller.MembershipService, "MembershipService property did not match.");
        }