Exemplo n.º 1
0
        public void Should_return_false_if_permission_to_include_is_null()
        {
            var sut = new PermissionSet(
                new Permission("app.contents"),
                new Permission("app.assets"));

            Assert.False(sut.Includes(null));
        }
Exemplo n.º 2
0
        public void Should_return_false_if_none_permission_includes_given()
        {
            var sut = new PermissionSet(
                new Permission("app.contents"),
                new Permission("app.assets"));

            Assert.False(sut.Includes(new Permission("other")));
        }
Exemplo n.º 3
0
        public void Should_return_true_if_any_permission_includes_child_given()
        {
            var sut = new PermissionSet(
                new Permission("app.contents"),
                new Permission("app.assets"));

            Assert.True(sut.Includes(new Permission("app.contents.read")));
        }
Exemplo n.º 4
0
        public void Should_include_permission_even_if_negation_exists()
        {
            var sut = new PermissionSet(
                new Permission("app.contents"),
                new Permission("app.assets"));

            Assert.True(sut.Includes(new Permission("app.contents.read")));
        }
Exemplo n.º 5
0
        public void Should_include_permission_if_any_permission_includes_parent_given()
        {
            var sut = new PermissionSet(
                new Permission("app.contents"),
                new Permission("app.assets"));

            Assert.True(sut.Includes(new Permission("app")));
        }
Exemplo n.º 6
0
        public void Should_add_permission()
        {
            var sut =
                new PermissionSet("app.contents")
                .Add(new Permission("admin.*"));

            Assert.True(sut.Includes(new Permission("admin")));
        }