public void TestCreateUser()
        {
            Uri addressBase = new Uri(WebServiceUnitTest.AddressBase);

            IMonitor monitor = new ConsoleMonitor();

            string fileName = CommaDelimitedFileUnitTest.ComposeFileName();

            FileProviderBase provider = null;
            try
            {
                provider = new FileProvider(fileName);
                Service webService = null;
                try
                {
                    webService = new WebService(monitor, provider);
                    webService.Start(addressBase);

                    IDictionary<string, object> json = ProviderTestTemplate<FileProvider>.ComposeUserResource().ToJson();
                    string characters = WebServiceUnitTest.Serializer.Value.Serialize(json);
                    byte[] bytes = Encoding.UTF8.GetBytes(characters);

                    Uri resource = new Uri(addressBase, WebServiceUnitTest.AddressRelativeUsers);

                    WebClient client = null;
                    try
                    {
                        client = new WebClient();
                        client.Headers.Add(HttpRequestHeader.ContentType, WebServiceUnitTest.ContentTypeJson);
                        byte[] response = client.UploadData(resource.AbsoluteUri, WebRequestMethods.Http.Post, bytes);
                        string responseCharacters = Encoding.UTF8.GetString(response);
                        IReadOnlyDictionary<string, object> responseJson =
                            WebServiceUnitTest.Serializer.Value.Deserialize<Dictionary<string, object>>(responseCharacters);
                        Core2EnterpriseUser user = new Core2EnterpriseUserJsonDeserializingFactory().Create(responseJson);
                        Assert.IsNotNull(user);
                        Assert.IsNotNull(
                            user
                            .Schemas
                            .SingleOrDefault(
                                (string item) =>
                                    string.Equals(
                                        SchemaIdentifiers.Core2EnterpriseUser,
                                        item,
                                        StringComparison.Ordinal)));
                        Assert.IsFalse(string.IsNullOrWhiteSpace(user.Identifier));
                        Assert.IsNotNull(user.Metadata);
                        Assert.IsFalse(string.IsNullOrWhiteSpace(user.Metadata.ResourceType));

                        string resourcePath = string.Concat(WebServiceUnitTest.AddressRelativeUser, user.Identifier);
                        resource = new Uri(addressBase, resourcePath);
                        bytes = new byte[0];
                        client.UploadData(resource, WebServiceUnitTest.MethodDelete, bytes);
                    }
                    finally
                    {
                        if (client != null)
                        {
                            client.Dispose();
                            client = null;
                        }
                    }
                }
                finally
                {
                    if (webService != null)
                    {
                        webService.Dispose();
                        webService = null;
                    }
                }
            }
            finally
            {
                if (provider != null)
                {
                    provider.Dispose();
                    provider = null;
                }
            }
            
        }
        private static void Main(string[] arguments)
        {
            if (null == arguments)
            {
                Console.WriteLine(FileProvisioningAgentResources.InformationCommandLineArguments);
                return;
            }

            if (Program.NumberArguments > arguments.Length)
            {
                Console.WriteLine(FileProvisioningAgentResources.InformationCommandLineArguments);
                return;
            }

            string argumentBaseAddress = arguments[0];
            Uri baseAddress = null;
            if (!Uri.TryCreate(argumentBaseAddress, UriKind.Absolute, out baseAddress))
            {
                Console.WriteLine(FileProvisioningAgentResources.InformationCommandLineArguments);
                return;
            }

            string informationBaseAddress =
                string.Format(
                    CultureInfo.InvariantCulture,
                    ProvisioningAgentResources.InformationBaseAddressTemplate,
                    argumentBaseAddress);
            Console.WriteLine(informationBaseAddress);

            IMonitor monitor = new ConsoleMonitor();
            FileProviderBase provider = null;
            try
            {
                provider = new FileProvider(arguments[1]);
                Service webService = null;
                try
                {
                    webService = new WebService(monitor, provider);
                    webService.Start(baseAddress);

                    string informationStarted =
                        string.Format(
                            CultureInfo.InvariantCulture,
                            ProvisioningAgentResources.InformationAgentStartedTemplate,
                            argumentBaseAddress);
                    Console.WriteLine(informationStarted);

                    Console.WriteLine(ProvisioningAgentResources.PromptTerminate);
                    Console.ReadKey(true);
                }
                finally
                {
                    if (webService != null)
                    {
                        webService.Dispose();
                        webService = null;
                    }
                }
            }
            finally
            {
                if (provider != null)
                {
                    provider.Dispose();
                    provider = null;
                }
            }
        }
        public void TestRetrieveGroup()
        {
            Uri addressBase = new Uri(WebServiceUnitTest.AddressBase);

            IMonitor monitor = new ConsoleMonitor();

            string fileName = CommaDelimitedFileUnitTest.ComposeFileName();

            FileProviderBase provider = null;
            try
            {
                provider = new FileProvider(fileName);
                Service webService = null;
                try
                {
                    webService = new WebService(monitor, provider);
                    webService.Start(addressBase);

                    Guid groupIdentifier = Guid.NewGuid();
                    string resourceRelative =
                        string.Format(
                            CultureInfo.InvariantCulture,
                            WebServiceUnitTest.AddressRelativeGroupTemplate,
                            groupIdentifier);
                    Uri resource = new Uri(addressBase, resourceRelative);

                    HttpWebResponse response = null;

                    WebClient client = null;
                    try
                    {
                        client = new WebClient();
                        try
                        {
                            client.DownloadData(resource);
                        }
                        catch (WebException exception)
                        {
                            response = exception.Response as HttpWebResponse;
                        }
                    }
                    finally
                    {
                        if (client != null)
                        {
                            client.Dispose();
                            client = null;
                        }
                    }

                    Assert.IsNotNull(response);
                    Assert.AreEqual(HttpStatusCode.NotFound, response.StatusCode);
                }
                finally
                {
                    if (webService != null)
                    {
                        webService.Dispose();
                        webService = null;
                    }
                }
            }
            finally
            {
                if (provider != null)
                {
                    provider.Dispose();
                    provider = null;
                }
            }

        }