public async Task Write_Query_Query_Is_Null()
        {
            string path = null;

            try
            {
                // arrange
                path = IOPath.Combine(
                    IOPath.GetTempPath(),
                    "d_" + Guid.NewGuid().ToString("N"));
                Directory.CreateDirectory(path);

                var storage = new FileSystemQueryStorage(
                    new DefaultQueryFileMap(path));

                // act
                Task Action() => storage.WriteQueryAsync("1234", null !);

                // assert
                await Assert.ThrowsAsync <ArgumentNullException>(Action);
            }
            finally
            {
                if (path != null)
                {
                    Directory.Delete(path, true);
                }
            }
        }
        public async Task Write_Query_QueryId_Invalid(string queryId)
        {
            string path = null;

            try
            {
                // arrange
                path = IOPath.Combine(
                    IOPath.GetTempPath(),
                    "d_" + Guid.NewGuid().ToString("N"));
                Directory.CreateDirectory(path);

                var storage = new FileSystemQueryStorage(
                    new DefaultQueryFileMap(path));

                var query = new QuerySourceText("{ foo }");

                // act
                Func <Task> action =
                    () => storage.WriteQueryAsync(queryId, query);

                // assert
                await Assert.ThrowsAsync <ArgumentNullException>(action);
            }
            finally
            {
                if (path != null)
                {
                    Directory.Delete(path, true);
                }
            }
        }
        public async Task Read_Query_From_Storage()
        {
            string path = null;

            try
            {
                // arrange
                path = IOPath.Combine(IOPath.GetTempPath(), "d_" + Guid.NewGuid().ToString("N"));
                Directory.CreateDirectory(path);

                var storage = new FileSystemQueryStorage(new DefaultQueryFileMap(path));

                var queryId = "1234";
                await File.WriteAllTextAsync(IOPath.Combine(path, queryId + ".graphql"), "{ foo }");

                // act
                QueryDocument query = await storage.TryReadQueryAsync(queryId);

                // assert
                Assert.NotNull(query);
                query.Document.ToString().MatchSnapshot();
            }
            finally
            {
                if (path != null)
                {
                    Directory.Delete(path, true);
                }
            }
        }
        public async Task Write_Query_To_Storage()
        {
            string path = null;

            try
            {
                // arrange
                path = IOPath.Combine(
                    IOPath.GetTempPath(),
                    "d_" + Guid.NewGuid().ToString("N"));
                Directory.CreateDirectory(path);

                var storage = new FileSystemQueryStorage(
                    new DefaultQueryFileMap(path));

                var query   = new QuerySourceText("{ foo }");
                var queryId = "1234";

                // act
                await storage.WriteQueryAsync(queryId, query);

                // assert
                Assert.True(File.Exists(IOPath.Combine(path, "1234.graphql")));
                var content = await File.ReadAllBytesAsync(IOPath.Combine(path, "1234.graphql"));

                Utf8GraphQLParser.Parse(content).Print().MatchSnapshot();
            }
            finally
            {
                if (path != null)
                {
                    Directory.Delete(path, true);
                }
            }
        }