public void Shared() { this.SaveApplication(); try { var configuration = new Allors.Adapters.Object.SqlClient.Configuration { ConnectionString = ConnectionString, ObjectFactory = Config.ObjectFactory, }; Config.Default = new Allors.Adapters.Object.SqlClient.Database(configuration); Config.Serializable = null; this.SetUp(true); var id = Guid.NewGuid(); new CounterBuilder(this.Session).WithUniqueId(id).Build(); this.Session.Derive(true); this.Session.Commit(); Assert.AreEqual(1, Counters.NextValue(this.Session, id)); Assert.AreEqual(2, Counters.NextValue(this.Session, id)); Assert.AreEqual(3, Counters.NextValue(this.Session, id)); Assert.AreEqual(4, Counters.NextValue(this.Session, id)); } finally { this.RestoreApplication(); } }
public void SetUp() { var configuration = new Allors.Adapters.Object.SqlClient.Configuration { ConnectionString = ConfigurationManager.ConnectionStrings["allors"].ConnectionString, ObjectFactory = Config.ObjectFactory, CommandTimeout = 0 }; Config.Default = new Allors.Adapters.Object.SqlClient.Database(configuration); var config = new SpecsForMvcConfig(); config.UseIISExpress() .With(Project.Named("Website")) .CleanupPublishedFiles(); config.BuildRoutesUsing(RouteConfig.RegisterRoutes); //config.UseBrowser(BrowserDriver.InternetExplorer); //config.UseBrowser(BrowserDriver.Chrome); config.UseBrowser(BrowserDriver.Firefox); config.InterceptEmailMessagesOnPort(13565); this.host = new SpecsForIntegrationHost(config); // If you encounter errors then please run the following command at the command prompt // (make sure msbuild is in your path, e.g. use the Visual Studio Command Prompt) // // msbuild [SolutionName].sln /p:DeployOnBuild=true;DeployTarget=Package;_PackageTempDir="C:\github\allors\Base\Tests\bin\x64\Debug\SpecsForMvc.TempIntermediateDir using (var stringWriter = new StringWriter()) { TextWriter console = null; try { console = Console.Out; Console.SetOut(stringWriter); this.host.Start(); } catch (Exception ex) { try { if (this.host != null) { this.host.Shutdown(); } } finally { if (console != null) { Console.SetOut(console); } throw new Exception("Build failed. Output: " + stringWriter, ex); } } } }
public void Serializable() { var serializableConfiguration = new Allors.Adapters.Object.SqlClient.Configuration { ConnectionString = ConnectionString, ObjectFactory = this.ObjectFactory, IsolationLevel = IsolationLevel.Serializable }; var serializableDatabase = new Allors.Adapters.Object.SqlClient.Database(CreateServiceProvider(), serializableConfiguration); var configuration = new Allors.Adapters.Object.SqlClient.Configuration { ConnectionString = ConnectionString, ObjectFactory = this.ObjectFactory, Serializable = serializableDatabase }; var database = new Allors.Adapters.Object.SqlClient.Database(CreateServiceProvider(), configuration); this.Setup(database, true); var id = Guid.NewGuid(); new CounterBuilder(this.Session).WithUniqueId(id).Build(); this.Session.Derive(true); this.Session.Commit(); Assert.Equal(1, Counters.NextValue(this.Session, id)); Assert.Equal(2, Counters.NextValue(this.Session, id)); Assert.Equal(3, Counters.NextValue(this.Session, id)); Assert.Equal(4, Counters.NextValue(this.Session, id)); }
public void NonShared() { this.SaveApplication(); try { var configuration = new Allors.Adapters.Object.SqlClient.Configuration { ConnectionString = System.Configuration.ConfigurationManager.ConnectionStrings["allors"].ConnectionString, ObjectFactory = Config.ObjectFactory, }; Config.Default = new Allors.Adapters.Object.SqlClient.Database(configuration); Config.Serializable = null; this.SetUp(true); var id = Guid.NewGuid(); new CounterBuilder(this.Session).WithUniqueId(id).Build(); this.Session.Derive(true); this.Session.Commit(); Assert.AreEqual(1, Counters.NextValue(this.Session, id)); Assert.AreEqual(2, Counters.NextValue(this.Session, id)); Assert.AreEqual(3, Counters.NextValue(this.Session, id)); Assert.AreEqual(4, Counters.NextValue(this.Session, id)); } finally { this.RestoreApplication(); } }
public void Configuration(IAppBuilder app) { var configuration = new Allors.Adapters.Object.SqlClient.Configuration { ConnectionString = System.Configuration.ConfigurationManager.ConnectionStrings["allors"].ConnectionString, ObjectFactory = Config.ObjectFactory, }; Config.Default = new Allors.Adapters.Object.SqlClient.Database(configuration); // Identity app.CreatePerOwinContext <IdentityUserManager>(IdentityUserManager.Create); app.CreatePerOwinContext <IdentitySignInManager>(IdentitySignInManager.Create); app.UseCookieAuthentication(new CookieAuthenticationOptions { AuthenticationType = DefaultAuthenticationTypes.ApplicationCookie, LoginPath = new PathString("/Account/Login"), Provider = new CookieAuthenticationProvider { // Enables the application to validate the security stamp when the user logs in. // This is a security feature which is used when you change a password or add an external login to your account. OnValidateIdentity = SecurityStampValidator.OnValidateIdentity <IdentityUserManager, IdentityUser>( validateInterval: TimeSpan.FromMinutes(30), regenerateIdentity: (manager, user) => user.GenerateUserIdentityAsync(manager)) } }); }
public static void Config() { var configuration = new Allors.Adapters.Object.SqlClient.Configuration { ConnectionString = System.Configuration.ConfigurationManager.ConnectionStrings["allors"].ConnectionString, ObjectFactory = Allors.Config.ObjectFactory, }; Allors.Config.Default = new Allors.Adapters.Object.SqlClient.Database(configuration); }
protected void Application_Start() { var configuration = new Allors.Adapters.Object.SqlClient.Configuration { ConnectionString = System.Configuration.ConfigurationManager.ConnectionStrings["allors"].ConnectionString, ObjectFactory = Config.ObjectFactory, }; Config.Default = new Allors.Adapters.Object.SqlClient.Database(configuration); GlobalConfiguration.Configure(WebApiConfig.Register); FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); RouteConfig.RegisterRoutes(RouteTable.Routes); BundleConfig.RegisterBundles(BundleTable.Bundles); AllorsConfig.Register(); }
protected ServerTest() { const string FileName = @"base.appSettings.json"; var userSettings = $@"{Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData)}/allors/{FileName}"; var systemSettings = $@"{Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData)}/allors/{FileName}"; this.Configuration = new ConfigurationBuilder() .AddJsonFile(@"appSettings.json") .AddJsonFile(systemSettings, true) .AddJsonFile(userSettings, true) .AddEnvironmentVariables() .Build(); this.ObjectFactory = new ObjectFactory(MetaPopulation.Instance, typeof(User)); var configuration = new Allors.Adapters.Object.SqlClient.Configuration { ObjectFactory = this.ObjectFactory, ConnectionString = this.Configuration.GetConnectionString("DefaultConnection") }; var services = new ServiceCollection(); services.AddAllors(); var serviceProvider = services.BuildServiceProvider(); this.HttpClientHandler = new HttpClientHandler(); this.HttpClient = new HttpClient(this.HttpClientHandler) { BaseAddress = new Uri(Url), }; this.HttpClient.DefaultRequestHeaders.Accept.Clear(); this.HttpClient.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); var result = this.HttpClient.GetAsync("Test/Setup").Result; var database = new Allors.Adapters.Object.SqlClient.Database(serviceProvider, configuration); this.Session = database.CreateSession(); }