Esempio 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));
        }
Esempio 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")));
        }
Esempio 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")));
        }
Esempio 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")));
        }
Esempio 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")));
        }
Esempio 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")));
        }