public void TestAddAbilityWithChildAbilities() { _authorizationService = new AbilityAuthorizationService(new UserRepository(), new RoleRepository(), new AbilityRepository()); _authorizationService.AddAbility(_ability3); IAbility ability = _authorizationService.GetAbility("Ability3"); Assert.AreEqual(ability, _ability3); Assert.AreEqual(2, _ability3.Abilities.Count); Assert.True(ability.Abilities.SequenceEqual(_ability3.Abilities)); }
public void TestGetAbilities() { _authorizationService = new AbilityAuthorizationService(new UserRepository(), new RoleRepository(), new AbilityRepository()); _authorizationService.AddAbility(_ability1); _authorizationService.AddAbility(_ability2); IEnumerable<IAbility> abilitys = _authorizationService.GetAbilities(); Assert.AreEqual(2, abilitys.Count()); Assert.AreEqual(_ability1, abilitys.First()); Assert.AreEqual(_ability2, abilitys.Last()); }
public void TestGetAbility() { _authorizationService = new AbilityAuthorizationService(new UserRepository(), new RoleRepository(), new AbilityRepository()); _authorizationService.AddAbility(_ability1); _authorizationService.AddAbility(_ability2); IAbility ability = _authorizationService.GetAbility("Ability1"); Assert.AreEqual(ability, _ability1); }