Beispiel #1
0
        protected void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();

            WebApiConfig.Register(GlobalConfiguration.Configuration);
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            BundleConfig.RegisterBundles(BundleTable.Bundles);

            GlobalFilters.Filters.Add(new RavenSessionAttribute());
            InitializeRavenDb();
            string defaultSiteAdministratorPassword = ConfigurationManager.AppSettings["DefaultSiteAdministratorPassword"];

            if (string.IsNullOrWhiteSpace(defaultSiteAdministratorPassword))
            {
                defaultSiteAdministratorPassword = "******";
            }
            SecuritySeeder.Run(RavenStore, defaultSiteAdministratorPassword);
        }
Beispiel #2
0
        public void If_There_Are_No_Users_A_Site_Administrator_Is_Created()
        {
            var siteAdministratorPassword = "******";

            // Act
            Act(() => {
                SecuritySeeder.Run(_store, siteAdministratorPassword);
            });
            // Assert
            AssertThat(() => {
                var masterAdministrator = _session.Query <User>().SingleOrDefault();

                Assert.NotNull(masterAdministrator);

                masterAdministrator.ShouldBeEquivalentTo(new
                {
                    Id       = "users/1",
                    Username = "******",
                    Roles    = new[] { "siteadministrator", "administrator" },
                    Company  = (EntityReference)null
                },
                                                         options => options.Excluding(x => x.Password));
            });
        }