public void CompileTest()
        {
            var decorator = new ScopeEnumDecorator();
            var service = new MockService();
            var decl = new CodeTypeDeclaration("TestClass");

            // Test with a simple scope enumeration
            service.Scopes.Add("a", new Scope { ID = "a", Description = "description A" });
            service.Scopes.Add("b", new Scope { ID = "b", Description = "description B" });

            Scope complex = new Scope() { ID = "https://example.com/test/auth123" };
            service.Scopes.Add(complex.ID, complex);

            decorator.DecorateClass(service, decl);
            CheckCompile(decl, false, "Failed To Compile ScopeEnumDecorator");
        }
        internal static string GetValueName(Scope scope)
        {
            scope.ThrowIfNull("scope");
            scope.ID.ThrowIfNullOrEmpty("scope.ID");

            // Try to parse the scope as an url.
            Uri uri;
            if (!Uri.TryCreate(scope.ID, UriKind.RelativeOrAbsolute, out uri))
            {
                return scope.ID; // Just return the value name.
            }

            // Return the last fragmenet of this uri.
            if (uri.IsAbsoluteUri && uri.Segments.Length > 0)
            {
                string segment = uri.Segments.Last();

                if (segment.Length >= 3)
                {
                    // Identifier should have three characters at least.
                    return segment;
                }
            }

            // Otherwise return the whole scope id.
            return scope.ID;
        }