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();
            }
        }
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        static void Main(string[] args)
        {
            if (Environment.UserInteractive)
            {
                NativeMethods.AllocConsole();

                var app = new KeyRepositoryApp();
                app.Start();

                Console.Write("KeyRepositoryApp Console started. Type 'Return' to stop the application... ");

                var input = Console.ReadKey(true);
                while(input.Key != ConsoleKey.Enter)
                {
                    Console.Beep();
                    input = Console.ReadKey(true);
                }

                // Stop the application.
                app.Stop();
            }
            else
            {
                var servicesToRun = new ServiceBase[] { new KeyManagerWindowsService() };
                ServiceBase.Run(servicesToRun);
            }
        }
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        static void Main(string[] args)
        {
            if (Environment.UserInteractive)
            {
                NativeMethods.AllocConsole();

                var app = new KeyRepositoryApp();
                app.Start();

                Console.Write("KeyRepositoryApp Console started. Type 'Return' to stop the application... ");


                var input = Console.ReadKey(true);
                while (input.Key != ConsoleKey.Enter)
                {
                    Console.Beep();
                    input = Console.ReadKey(true);
                }

                // Stop the application.
                app.Stop();
            }
            else
            {
                var servicesToRun = new ServiceBase[] { new KeyManagerWindowsService() };
                ServiceBase.Run(servicesToRun);
            }
        }
 public void KeyRepositoryAuthorizationManager()
 {
     var app = new KeyRepositoryApp();
     try
     {
         app.Start();
         Assert.Equal(app.ServiceHost.Authorization.ServiceAuthorizationManager.GetType().FullName,
                      "KeyManager.KeyRepositoryAuthorizationManager");
     }
     finally
     {
         app.Stop();
     }
 }
예제 #5
0
 protected override void OnStart(string[] args)
 {
     _app.Start();
 }