コード例 #1
0
        public void KeyRepositoryAuthorizationManager()
        {
            var app = new KeyRepositoryApp();

            try
            {
                app.Start();
                Assert.Equal(app.ServiceHost.Authorization.ServiceAuthorizationManager.GetType().FullName,
                             "KeyManager.KeyRepositoryAuthorizationManager");
            }
            finally
            {
                app.Stop();
            }
        }
コード例 #2
0
        public void ShouldWriteKey()
        {
            var app = new KeyRepositoryApp(new ServiceAuthorizationManager());

            try
            {
                app.Start();

                var proxy = new KeyRepositoryClient();

                const string institution = "ShouldWriteKeyInstitution";
                const string group       = "ShouldWriteKeyGroup";
                const string product     = "KeyManager";


                var keyName = String.Format("{0}__{1}__{2}", institution, group, product);
                var keyPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "Physion", "Ovation", "keys", keyName);

                if (File.Exists(keyPath))
                {
                    File.Delete(keyPath);
                }

                proxy.WriteKey(institution, group, product, "some key");

                Assert.True(File.Exists(keyPath));

                if (File.Exists(keyPath))
                {
                    File.Delete(keyPath);
                }
            }
            finally
            {
                app.Stop();
            }
        }