예제 #1
0
        public void ShouldGetDefaultValuesIfNoBefaviourSet()
        {
            // arrange
            var stubProvider = new FakeRolesInRolesProvider();

            // act & assert
            stubProvider.FindRolesInRole(null, null, false).Should().BeEmpty();
            stubProvider.FindUsersInRole(null, null, false).Should().BeEmpty();
            stubProvider.GetAllRoles(false).Should().BeEmpty();
            stubProvider.GetCreatorOwnerRole().Should().Be(Role.FromName("Creator-Owner"));
            stubProvider.GetEveryoneRole().Should().Be(Role.FromName("Everyone"));
            stubProvider.GetEveryoneRoles().Should().BeEmpty();
            stubProvider.GetGlobalRoles().Should().BeEmpty();
            stubProvider.GetRoleMembers(null, true).Should().BeEmpty();
            stubProvider.GetRolesForRole(null, true).Should().BeEmpty();
            stubProvider.GetRolesForUser(null, true).Should().BeEmpty();
            stubProvider.GetRolesInRole(null, true).Should().BeEmpty();
            stubProvider.GetSystemRoles().Should().BeEmpty();
            stubProvider.GetUsersInRole(null, true).Should().BeEmpty();
            stubProvider.IsCreatorOwnerRole(null).Should().BeFalse();
            stubProvider.IsEveryoneRole("Everyone").Should().BeTrue();
            stubProvider.IsEveryoneRole("Everyone", Domain.GetDomain("extranet")).Should().BeTrue();
            stubProvider.IsGlobalRole(null).Should().BeFalse();
            stubProvider.IsRoleInRole(null, null, true).Should().BeFalse();
            stubProvider.IsSystemRole(null).Should().BeFalse();
            stubProvider.IsUserInRole(null, null, true).Should().BeFalse();
        }
예제 #2
0
        public FakeRolesInRolesProviderTest()
        {
            this.localProvider = Substitute.For <RolesInRolesProvider>();

            this.provider = new FakeRolesInRolesProvider();
            this.provider.LocalProvider.Value = this.localProvider;
        }
예제 #3
0
        public void ShouldNotThrowIfNoBefaviourSet()
        {
            // arrange
            var stubProvider = new FakeRolesInRolesProvider();

            // act & assert
            stubProvider.AddRolesToRoles(null, null);
            stubProvider.FindRolesInRole(null, null, false);
            stubProvider.FindUsersInRole(null, null, false);
            stubProvider.GetAllRoles(false);
            stubProvider.GetCreatorOwnerRole();
            stubProvider.GetEveryoneRole();
            stubProvider.GetEveryoneRoles();
            stubProvider.GetGlobalRoles();
            stubProvider.GetRoleMembers(null, true);
            stubProvider.GetRolesForRole(null, true);
            stubProvider.GetRolesForUser(null, true);
            stubProvider.GetRolesInRole(null, true);
            stubProvider.GetSystemRoles();
            stubProvider.GetUsersInRole(null, true);
            stubProvider.IsCreatorOwnerRole(null);
            stubProvider.IsEveryoneRole("Everyone");
            stubProvider.IsEveryoneRole("Everyone", Domain.GetDomain("exranet"));
            stubProvider.IsGlobalRole(null);
            stubProvider.IsRoleInRole(null, null, true);
            stubProvider.IsSystemRole(null);
            stubProvider.IsUserInRole(null, null, true);
            stubProvider.RemoveRoleRelations(null);
            stubProvider.RemoveRolesFromRoles(null, null);
        }
    public void ShouldNotThrowIfNoBefaviourSet()
    {
      // arrange
      var stubProvider = new FakeRolesInRolesProvider();

      // act & assert
      stubProvider.AddRolesToRoles(null, null);
      stubProvider.FindRolesInRole(null, null, false);
      stubProvider.FindUsersInRole(null, null, false);
      stubProvider.GetAllRoles(false);
      stubProvider.GetCreatorOwnerRole();
      stubProvider.GetEveryoneRole();
      stubProvider.GetEveryoneRoles();
      stubProvider.GetGlobalRoles();
      stubProvider.GetRoleMembers(null, true);
      stubProvider.GetRolesForRole(null, true);
      stubProvider.GetRolesForUser(null, true);
      stubProvider.GetRolesInRole(null, true);
      stubProvider.GetSystemRoles();
      stubProvider.GetUsersInRole(null, true);
      stubProvider.IsCreatorOwnerRole(null);
      stubProvider.IsEveryoneRole("Everyone");
      stubProvider.IsEveryoneRole("Everyone", Domain.GetDomain("exranet"));
      stubProvider.IsGlobalRole(null);
      stubProvider.IsRoleInRole(null, null, true);
      stubProvider.IsSystemRole(null);
      stubProvider.IsUserInRole(null, null, true);
      stubProvider.RemoveRoleRelations(null);
      stubProvider.RemoveRolesFromRoles(null, null);
    }
예제 #5
0
        public void ShouldCheckIfDomainEveryoneRole(string roleName, bool expectedResult)
        {
            var stubProvider = new FakeRolesInRolesProvider();
            var domain       = Domain.GetDomain("extranet");

            stubProvider.IsEveryoneRole(roleName, domain).Should().Be(expectedResult);
        }
    public void ShouldGetDefaultValuesIfNoBefaviourSet()
    {
      // arrange
      var stubProvider = new FakeRolesInRolesProvider();

      // act & assert
      stubProvider.FindRolesInRole(null, null, false).Should().BeEmpty();
      stubProvider.FindUsersInRole(null, null, false).Should().BeEmpty();
      stubProvider.GetAllRoles(false).Should().BeEmpty();
      stubProvider.GetCreatorOwnerRole().Should().Be(Role.FromName("Creator-Owner"));
      stubProvider.GetEveryoneRole().Should().Be(Role.FromName("Everyone"));
      stubProvider.GetEveryoneRoles().Should().BeEmpty();
      stubProvider.GetGlobalRoles().Should().BeEmpty();
      stubProvider.GetRoleMembers(null, true).Should().BeEmpty();
      stubProvider.GetRolesForRole(null, true).Should().BeEmpty();
      stubProvider.GetRolesForUser(null, true).Should().BeEmpty();
      stubProvider.GetRolesInRole(null, true).Should().BeEmpty();
      stubProvider.GetSystemRoles().Should().BeEmpty();
      stubProvider.GetUsersInRole(null, true).Should().BeEmpty();
      stubProvider.IsCreatorOwnerRole(null).Should().BeFalse();
      stubProvider.IsEveryoneRole("Everyone").Should().BeTrue();
      stubProvider.IsEveryoneRole("Everyone", Domain.GetDomain("extranet")).Should().BeTrue();
      stubProvider.IsGlobalRole(null).Should().BeFalse();
      stubProvider.IsRoleInRole(null, null, true).Should().BeFalse();
      stubProvider.IsSystemRole(null).Should().BeFalse();
      stubProvider.IsUserInRole(null, null, true).Should().BeFalse();
    }
    public FakeRolesInRolesProviderTest()
    {
      this.localProvider = Substitute.For<RolesInRolesProvider>();

      this.provider = new FakeRolesInRolesProvider();
      this.provider.LocalProvider.Value = this.localProvider;
    }
예제 #8
0
        public void ShouldCheckIfEveryoneRole(string roleName, bool expectedResult)
        {
            // arrange
            var stubProvider = new FakeRolesInRolesProvider();

            // act & assert
            stubProvider.IsEveryoneRole(roleName).Should().Be(expectedResult);
        }
예제 #9
0
 public void ShouldCheckIfEveryoneRole(string roleName, bool expectedResult, FakeRolesInRolesProvider sut)
 {
     sut.IsEveryoneRole(roleName).Should().Be(expectedResult);
 }
    public void ShouldCheckIfDomainEveryoneRole(string roleName, bool expectedResult)
    {
      // arrange
      var stubProvider = new FakeRolesInRolesProvider();
      var domain = Domain.GetDomain("extranet");

      // act & assert
      stubProvider.IsEveryoneRole(roleName, domain).Should().Be(expectedResult);
    }
    public void ShouldCheckIfEveryoneRole(string roleName, bool expectedResult)
    {
      // arrange
      var stubProvider = new FakeRolesInRolesProvider();

      // act & assert
      stubProvider.IsEveryoneRole(roleName).Should().Be(expectedResult);
    }
 public void ShouldCheckIfEveryoneRole(string roleName, bool expectedResult, FakeRolesInRolesProvider sut)
 {
   sut.IsEveryoneRole(roleName).Should().Be(expectedResult);
 }