public void ConstructorSetsPropertiesToDefaultValues() { // Act AccountController controller = new AccountController(); // Assert Assert.That(controller.FormsAuth != null, "FormsAuth property is null."); Assert.That(controller.MembershipService != null, "MembershipService property is null."); }
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; }
public void ConstructorSetsProperties() { // Arrange IFormsAuthentication formsAuth = new MockFormsAuthenticationService(); IMembershipService membershipService = new AccountMembershipService(); // Act AccountController controller = new AccountController(formsAuth, membershipService); // Assert Assert.That(formsAuth, Is.EqualTo(controller.FormsAuth), "FormsAuth property did not match."); Assert.That(membershipService, Is.EqualTo(controller.MembershipService), "MembershipService property did not match."); }