コード例 #1
0
        public void ToActivity()
        {
            var element = new ActivityElement
            {
                Name = "Resource.Action",
                AllowUnauthenticated = true,
                Default = true,
                Allow   = new PermissionElement
                {
                    Roles = "A",
                    Users = "Alice"
                },
                Deny = new PermissionElement
                {
                    Roles = "B",
                    Users = "Bob"
                }
            };

            var expected = new Activity
            {
                Resource             = "Resource",
                Action               = "Action",
                AllowUnauthenticated = true,
                Default              = true,
                Allow = new Permission
                {
                    Roles = new List <string> {
                        "A"
                    },
                    Users = new List <string> {
                        "Alice"
                    }
                },
                Deny = new Permission
                {
                    Roles = new List <string> {
                        "B"
                    },
                    Users = new List <string> {
                        "Bob"
                    }
                },
            };

            var candidate = element.ToActivity();

            Check(expected, candidate);
        }