public async void Run_Test()
        {
            var mockHandler = new MockHttpMessageHandler();
            var client      = mockHandler.ToHttpClient();

            var actx  = Substitute.For <IApplicationContext>();
            var appId = Guid.NewGuid().ToString();

            actx.GetAppId().Returns(appId);

            var service = new TestLicenseService(actx, client);
            var path    = service.GetPath();

            service.AppId = "ae8cdf5f-26b3-4e2f-8e68-6ecc2e73720f";

            var dir = Path.Combine(AppDomain.CurrentDomain.SetupInformation.ApplicationBase, "Data", "test.license.xml");

            try
            {
                File.WriteAllText(path, File.ReadAllText(dir));

                await service.RunAsync();

                Assert.Equal(AppLicense.Full, LicenseGlobals.Get());
            }
            finally
            {
                File.Delete(path);
            }
        }
        public async void ValidateAsync_Invalid()
        {
            var mockHandler = new MockHttpMessageHandler();
            var client      = mockHandler.ToHttpClient();

            var actx  = Substitute.For <IApplicationContext>();
            var appId = Guid.NewGuid().ToString();

            actx.GetAppId().Returns(appId);

            var service = new TestLicenseService(actx, client);
            var path    = service.GetPath();

            service.AppId = "2EEB2CE7-0A1E-442D-BF0B-BB074A3DCFB6";

            var dir = Path.Combine(AppDomain.CurrentDomain.SetupInformation.ApplicationBase, "Data", "test.license.xml");

            try
            {
                File.WriteAllText(path, File.ReadAllText(dir));

                var result = await service.ValidateAsync();

                Assert.False(result.Successful);
                Assert.Null(result.License);
                Assert.Null(result.Exception);
                Assert.Equal("VAL.04", result.Failures.ElementAt(0).Code);
            }
            finally
            {
                File.Delete(path);
            }
        }
        public async void ValidateAsync_Valid()
        {
            var mockHandler = new MockHttpMessageHandler();
            var client      = mockHandler.ToHttpClient();

            var actx  = Substitute.For <IApplicationContext>();
            var appId = new Guid("ae8cdf5f-26b3-4e2f-8e68-6ecc2e73720f");

            actx.GetAppId().Returns(appId.ToString());

            var service = new TestLicenseService(actx, client);
            var path    = service.GetPath();

            service.AppId = appId.ToString();

            var dir = Path.Combine(AppDomain.CurrentDomain.SetupInformation.ApplicationBase, "Data", "test.license.xml");

            try
            {
                File.WriteAllText(path, File.ReadAllText(dir));

                var result = await service.ValidateAsync();

                Assert.True(result.Successful);
                Assert.NotNull(result.License);
                Assert.Null(result.Exception);
                Assert.False(result.Failures.Any());
            }
            finally
            {
                File.Delete(path);
            }
        }