Пример #1
0
 public void create_a_context_without_warmup_without_failure()
 {
     using (var system = new SerenitySystem())
     {
         system.As <ISystem>().CreateContext().ShouldBeOfType <SerenitySystem.SerenityContext>();
     }
 }
Пример #2
0
        public void warmup_will_create_a_fuburuntime()
        {
            using (var system = new SerenitySystem())
            {
                system.As <ISystem>().Warmup().Wait();

                system.Runtime.ShouldNotBeNull();
            }
        }
Пример #3
0
        public void add_an_application()
        {
            var system = new SerenitySystem();
            system.AddApplication(new Foo());

            var app = system.Applications.PrimaryApplication();
            app.ShouldNotBeNull();
            app.Name.ShouldEqual("Foo");
        }
Пример #4
0
        public void the_build_runtime_will_be_in_testing_mode()
        {
            using (var system = new SerenitySystem())
            {
                system.As <ISystem>().Warmup().Wait();

                system.Runtime.Mode.InTesting().ShouldBeTrue();
            }
        }
Пример #5
0
        public void add_an_application()
        {
            var system = new SerenitySystem();

            system.AddApplication(new Foo());

            var app = system.Applications.PrimaryApplication();

            app.ShouldNotBeNull();
            app.Name.ShouldEqual("Foo");
        }
        public void build_for_a_system_all_defaults()
        {
            Project.CurrentProject = new Project { Profile = null };
            using (var system = new SerenitySystem())
            {
                system.As<ISystem>().Warmup().Wait();

                system.Runtime.Get<IBrowserLifecycle>()
                    .ShouldBeOfType<ChromeBrowser>();
            }
        }
        public void build_for_a_system_with_default()
        {
            Project.CurrentProject = new Project { Profile = null };
            using (var system = new SerenitySystem{DefaultBrowser = BrowserType.Firefox})
            {
                system.As<ISystem>().Warmup().Wait();

                system.Runtime.Get<IBrowserLifecycle>()
                    .ShouldBeOfType<FirefoxBrowser>();
            }
        }
        public void build_with_system_for_profile()
        {
            Project.CurrentProject = new Project { Profile = "phantom/katana" };
            using (var system = new SerenitySystem { DefaultBrowser = BrowserType.Firefox })
            {
                system.As<ISystem>().Warmup().Wait();

                system.Runtime.Get<IBrowserLifecycle>()
                    .ShouldBeOfType<PhantomBrowser>();
            }
        }
Пример #9
0
        public void register_services_puts_both_the_serenity_applications_and_primary_app_in()
        {
            var system = new SerenitySystem();
            system.AddApplication<Foo>();
            system.AddApplication<Bar>();

            var context = new TestContext();
            system.RegisterServices(context);

            context.Retrieve<IApplicationUnderTest>().Name.ShouldEqual("Foo");
            context.Retrieve<SerenityApplications>().ShouldBeTheSameAs(system.Applications);
        }
Пример #10
0
        public void security_settings_are_reset_on_each_test_run()
        {
            using (var system = new SerenitySystem())
            {
                system.As <ISystem>().CreateContext();
                system.Runtime.Get <SecuritySettings>().AuthenticationEnabled = false;

                // okay, now create a new context and the settings should go back to everything
                // being enabled
                system.As <ISystem>().CreateContext();
                system.Runtime.Get <SecuritySettings>().AuthenticationEnabled.ShouldBeTrue();
            }
        }
Пример #11
0
        public void build_for_a_system_all_defaults()
        {
            Project.CurrentProject = new Project {
                Profile = null
            };
            using (var system = new SerenitySystem())
            {
                system.As <ISystem>().Warmup().Wait();

                system.Runtime.Get <IBrowserLifecycle>()
                .ShouldBeOfType <ChromeBrowser>();
            }
        }
Пример #12
0
        public void register_services_puts_both_the_serenity_applications_and_primary_app_in()
        {
            var system = new SerenitySystem();

            system.AddApplication <Foo>();
            system.AddApplication <Bar>();

            var context = new TestContext();

            system.RegisterServices(context);

            context.Retrieve <IApplicationUnderTest>().Name.ShouldEqual("Foo");
            context.Retrieve <SerenityApplications>().ShouldBeTheSameAs(system.Applications);
        }
Пример #13
0
        public void build_with_system_for_profile()
        {
            Project.CurrentProject = new Project {
                Profile = "phantom/katana"
            };
            using (var system = new SerenitySystem {
                DefaultBrowser = BrowserType.Firefox
            })
            {
                system.As <ISystem>().Warmup().Wait();

                system.Runtime.Get <IBrowserLifecycle>()
                .ShouldBeOfType <PhantomBrowser>();
            }
        }
Пример #14
0
        public void build_for_a_system_with_default()
        {
            Project.CurrentProject = new Project {
                Profile = null
            };
            using (var system = new SerenitySystem {
                DefaultBrowser = BrowserType.Firefox
            })
            {
                system.As <ISystem>().Warmup().Wait();

                system.Runtime.Get <IBrowserLifecycle>()
                .ShouldBeOfType <FirefoxBrowser>();
            }
        }
        public SystemModule()
        {
            Get["/system"] = _ =>
            {
                var system = new SerenitySystem()
                {
                    Id = GuidUtil.GetDeterministicGuid(NetworkUtil.GetSystemMacAddress()).ToString(),
                };

                system.Links.Add(Constants.Rels.DEVICE, new Uri("/system/local", UriKind.Relative));
                system.Links.Add(Constants.Rels.DEVICES, new Uri("/system/devices", UriKind.Relative));
                system.Links.Add(Constants.Rels.DATASOURCES, new Uri("/system/datasources", UriKind.Relative));

                var response = Response.AsJson(system);
                response.ContentType = Constants.ContentTypes.SERENITY_RESOURCE;

                return(response);
            };
        }
Пример #16
0
 public void create_a_context_without_warmup_without_failure()
 {
     using (var system = new SerenitySystem())
     {
         system.As<ISystem>().CreateContext().ShouldBeOfType<SerenitySystem.SerenityContext>();
     }
 }
Пример #17
0
        public void security_settings_are_reset_on_each_test_run()
        {
            using (var system = new SerenitySystem())
            {
                system.As<ISystem>().CreateContext();
                system.Runtime.Get<SecuritySettings>().AuthenticationEnabled = false;

                // okay, now create a new context and the settings should go back to everything
                // being enabled
                system.As<ISystem>().CreateContext();
                system.Runtime.Get<SecuritySettings>().AuthenticationEnabled.ShouldBeTrue();

            }
        }
Пример #18
0
        public void the_build_runtime_will_be_in_testing_mode()
        {
            using (var system = new SerenitySystem())
            {
                system.As<ISystem>().Warmup().Wait();

                system.Runtime.Mode.InTesting().ShouldBeTrue();
            }
        }
Пример #19
0
        public void warmup_will_create_a_fuburuntime()
        {
            using (var system = new SerenitySystem())
            {
                system.As<ISystem>().Warmup().Wait();

                system.Runtime.ShouldNotBeNull();
            }
        }