public void AddPermission() { DiSetup.Tests(); IUserService userService = DiHelper.GetService <IUserService>(); userService.Clear(); userService.CreateTestData(); AuthenticationService authenticationService = DiHelper.GetService <AuthenticationService>(); int permissioncountBefore = authenticationService.GetPermissions().Count(); var result = authenticationService.AddPermission(new Models.Permission("SomePermission")); int permissioncountAfter = authenticationService.GetPermissions().Count(); Assert.IsNotNull(result); Assert.AreEqual(true, result); Assert.IsTrue(permissioncountBefore + 1 == permissioncountAfter); }
public void AddPermissionNegative() { DiSetup.Tests(); IUserService userService = DiHelper.GetService <IUserService>(); userService.Clear(); userService.CreateTestData(); AuthenticationService authenticationService = DiHelper.GetService <AuthenticationService>(); var existingPermission = authenticationService.GetPermissions().ToList()[0]; int permissioncountBefore = authenticationService.GetPermissions().Count(); var result = authenticationService.AddPermission(existingPermission); //try to add an existing user int permissioncountAfter = authenticationService.GetPermissions().Count(); Assert.IsNotNull(result); Assert.AreEqual(false, result); Assert.IsTrue(permissioncountBefore == permissioncountAfter); }