Beispiel #1
0
        public async Task ManifestUI_ReturnsRelativeURL()
        {
            string fileName = Directory.GetCurrentDirectory() + @"\" + Guid.NewGuid().ToString() + ".json";

            SelfHostResult server = null;
            HttpClient     client = new HttpClient();

            try
            {
                File.WriteAllText(fileName, "{ }");
                server = NAMEServer.EnableName((config) =>
                {
                    config.LogHealthCheckToConsole = false;
                    config.APIName              = "teste";
                    config.APIVersion           = "1.0.0";
                    config.DependenciesFilePath = fileName;
                });

                var response = await client.GetAsync($"http://localhost:{server.ServerPort}/manifest/ui");

                Assert.Equal(HttpStatusCode.OK, response.StatusCode);

                Assert.Contains("loadfromURL(\"/manifest\");", await response.Content.ReadAsStringAsync());
            }
            finally
            {
                server?.Dispose();
                client.Dispose();
                File.Delete(fileName);
            }
        }
Beispiel #2
0
        static void Main(string[] args)
        {
            Action <NAMEKestrelConfiguration> configBuilder = config =>
            {
                Assembly a = typeof(Program).GetTypeInfo().Assembly;
                config.APIName    = a.GetName().Name;
                config.APIVersion = a.GetName().Version.ToString();
                config.LogHealthCheckToConsole = true;
                config.ThrowOnDependenciesFail = false;
            };

            using (var selfHost = NAMEServer.EnableName(configBuilder))
            {
                Console.WriteLine("Hello World!");

                Console.CancelKeyPress += new ConsoleCancelEventHandler(OnExit);
                _closing.WaitOne();
            }
        }