Exemplo n.º 1
0
        public void TestGetResourceId_CaseInsensitive()
        {
            var resourceType   = "project";
            var permissionName = "edit";
            var value          = 1;
            var instance       = new ABindingModel();

            instance.Id = value;
            var permission = new ModelPermission("model.iD", typeof(ABindingModel), permissionName, resourceType);
            var dictionary = GetActionArgumentsDictionary(instance, "model");

            Assert.AreEqual(value, permission.GetResourceId(dictionary));
        }
Exemplo n.º 2
0
        public void TestGetResourceId_ArgumentIsFirstLevelNode_MultipleDictionaryKeys()
        {
            var resourceType   = "project";
            var permissionName = "edit";
            var value          = 1;
            var instance       = new ABindingModel();

            instance.Id = value;
            var permission = new ModelPermission("model.Id", typeof(ABindingModel), permissionName, resourceType);
            var dictionary = GetActionArgumentsDictionary(instance, "model");

            dictionary.Add("key", "value");

            Assert.AreEqual(value, permission.GetResourceId(dictionary));
        }
Exemplo n.º 3
0
        public void TestGetResourceId_ArgumentIsSecondLevelNode()
        {
            var resourceType   = "project";
            var permissionName = "edit";
            var value          = 1;
            var instance       = new ABindingModel();

            instance.B = new BBindingModel
            {
                OtherId = value
            };
            var permission = new ModelPermission("model.B.OtherId", typeof(ABindingModel), permissionName, resourceType);
            var dictionary = GetActionArgumentsDictionary(instance, "model");

            Assert.AreEqual(value, permission.GetResourceId(dictionary));
        }