public async Task TestSparkResultException()
        {
            try
            {
                var spark = SparkAPI.CreateVersion1Client("this token does not exist");

                var result = await spark.GetMeAsync();

                var me = result.GetData();
            }
            catch (SparkResultException sre)
            {
                Assert.AreEqual(System.Net.HttpStatusCode.Unauthorized, sre.HttpStatusCode);
                Assert.AreEqual("The request requires a valid access token set in the Authorization request header.", sre.Message);
                Assert.IsNotNull(sre.TrackingId);
            }

            try
            {
                var result = await this.spark.CreateMessageAsync("this space id does not exist", "hello");

                var m = result.GetData();
            }
            catch (SparkResultException sre)
            {
                Assert.AreEqual(System.Net.HttpStatusCode.NotFound, sre.HttpStatusCode);
                //Assert.AreEqual("The requested resource could not be found.(ErrorCode:1)", sre.Message);
                Assert.IsTrue(sre.Message.StartsWith("The requested resource could not be found."));
                Assert.IsNotNull(sre.TrackingId);
            }
        }
        public async Task Init()
        {
            string userDir = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile);

            var dirInfo = new DirectoryInfo(String.Format("{0}{1}.thrzn41{1}unittest{1}spark", userDir, Path.DirectorySeparatorChar));

            byte[] encryptedToken;
            byte[] entropy;

            using (var stream = new FileStream(String.Format("{0}{1}sparktoken.dat", dirInfo.FullName, Path.DirectorySeparatorChar), FileMode.Open, FileAccess.Read, FileShare.Read))
                using (var memory = new MemoryStream())
                {
                    stream.CopyTo(memory);

                    encryptedToken = memory.ToArray();
                }

            using (var stream = new FileStream(String.Format("{0}{1}tokenentropy.dat", dirInfo.FullName, Path.DirectorySeparatorChar), FileMode.Open, FileAccess.Read, FileShare.Read))
                using (var memory = new MemoryStream())
                {
                    stream.CopyTo(memory);

                    entropy = memory.ToArray();
                }

            spark = SparkAPI.CreateVersion1Client(LocalProtectedString.FromEncryptedData(encryptedToken, entropy));

            var r = await spark.ListSpacesAsync(sortBy : SpaceSortBy.Created, max : 50);

            while (true)
            {
                if (r.IsSuccessStatus && r.Data.HasItems)
                {
                    foreach (var item in r.Data.Items)
                    {
                        if (item.Title.Contains(UNIT_TEST_SPACE_TAG))
                        {
                            unitTestSpace = item;
                            break;
                        }
                    }
                }

                if (unitTestSpace == null && r.HasNext)
                {
                    r = await r.ListNextAsync();
                }
                else
                {
                    break;
                }
            }


            checkSparkAPIClient();
            checkUnitTestSpace();
        }