static WebTest() { var mapper = new AssemblyScanningMappingProvider(); mapper.Scan(typeof(AccountRepository).Assembly); EntityMappingProvider.Provider = mapper; _databaseManager.CreateEmptyDatabase(); _databaseManager.InitSchema(); AppDomain.CurrentDomain.DomainUnload += (o, e) => { _iisExpress?.Stop(); _databaseManager.Dispose(); }; // Disables database migration in codeRR.Server.Web project, should be up-to-date already // SchemaUpdateModule does not handle coderr_ConnectionString environment variable // This should only be run on build server due to changes in web.config if (Environment.GetEnvironmentVariable("TF_BUILD") != null) { DisableDatabaseMigrations(); } var configPath = Path.Combine(Path.GetFullPath(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, @"..\..\..\")), "applicationhost.config"); Console.WriteLine($"Path to IIS Express configuration file '{configPath}'"); _iisExpress = new IisExpressHelper { ConfigPath = configPath, // Pass on connectionstring to codeRR.Server.Web during testing, overriding connectionstring in web.config EnvironmentVariables = new Dictionary <string, string> { { "coderr_ConnectionString", _databaseManager.ConnectionString } } }; _iisExpress.Start("codeRR.Server.Web"); // Warmup request only on build server if (Environment.GetEnvironmentVariable("TF_BUILD") != null) { var webClient = new WebClient(); webClient.DownloadString(_iisExpress.BaseUrl); } TestUser = new TestUser { Username = "******", Password = "******", Email = "*****@*****.**" }; TestData = new TestDataManager(_databaseManager.OpenConnection) { TestUser = TestUser }; WebDriver = DriverFactory.Create(BrowserType.Chrome); AppDomain.CurrentDomain.DomainUnload += (o, e) => { DisposeWebDriver(); }; }
private static void ConfigureDataMapping() { var provider = new AssemblyScanningMappingProvider(); provider.Scan(typeof(UserMapper).Assembly); EntityMappingProvider.Provider = provider; }
static IntegrationTest() { var path2 = AppDomain.CurrentDomain.BaseDirectory; var logRepository = LogManager.GetRepository(Assembly.GetExecutingAssembly()); XmlConfigurator.ConfigureAndWatch(logRepository, new FileInfo(Path.Combine(path2, "log4net.config"))); var logger = LogManager.GetLogger(typeof(IntegrationTest)); logger.Info("Loaded"); AppDomain.CurrentDomain.DomainUnload += (o, e) => { if (_databaseManager == null) { return; } _databaseManager.Dispose(); _databaseManager = null; }; lock (SyncLock) { _databaseManager = new DatabaseManager(); _databaseManager.CreateEmptyDatabase(); _databaseManager.InitSchema(); } var mapper = new AssemblyScanningMappingProvider(); mapper.Scan(typeof(AccountRepository).Assembly); EntityMappingProvider.Provider = mapper; }
public ScanForMappings() { var provider = new AssemblyScanningMappingProvider(); provider.Scan(typeof(UserMapper).Assembly); EntityMappingProvider.Provider = provider; }
public void throw_on_invalid_mappers() { var sut = new AssemblyScanningMappingProvider(); Action actual = () => sut.Scan(Assembly.GetExecutingAssembly()); actual.Should().Throw <MappingException>(); }
public void throw_on_invalid_mappers() { var sut = new AssemblyScanningMappingProvider(); Action actual = () => sut.Scan(Assembly.GetExecutingAssembly()); actual.ShouldThrow<MappingException>(); }
public static void Main(string[] args) { ConfigureLog4Net(); var provider = new AssemblyScanningMappingProvider(); provider.Scan(typeof(AnalyticsRepository).Assembly); EntityMappingProvider.Provider = provider; BuildWebHost(args).Run(); }
public void ignore_mappings_that_are_interfaces() { var sut = new AssemblyScanningMappingProvider(); sut.IgnoreInvalidMappers = true; sut.ReplaceDuplicateMappers = true; sut.Scan(); Action actual = () => sut.Get<WithInterfaceMapping>(); actual.ShouldThrow<MappingNotFoundException>(); }
public void ignore_mappings_that_are_abstract() { var sut = new AssemblyScanningMappingProvider(); sut.IgnoreInvalidMappers = true; sut.ReplaceDuplicateMappers = true; sut.Scan(); Action actual = () => sut.Get<ClassThatHaveAnAbstractMapper>(); actual.ShouldThrow<MappingNotFoundException>(); }
public void use_the_ok_mapping() { var sut = new AssemblyScanningMappingProvider(); sut.IgnoreInvalidMappers = true; sut.ReplaceDuplicateMappers = true; sut.Scan(); var actual = sut.Get<Ok>(); actual.Should().NotBeNull(); }
public void using_the_mapperfor_attribute() { var sut = new AssemblyScanningMappingProvider(); sut.IgnoreInvalidMappers = true; sut.ReplaceDuplicateMappers = true; sut.Scan(); var actual = sut.Get(typeof(UsingAttribute)); actual.Should().NotBeNull(); }
private void ConfigureStandardSetup() { var provider = new AssemblyScanningMappingProvider(); provider.Scan(typeof(UserMapper).Assembly); EntityMappingProvider.Provider = provider; GlobalConfiguration.Configure(WebApiConfig.Register); FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); RouteConfig.RegisterRoutes(RouteTable.Routes); _serviceRunner.Start(); }
public void use_the_ok_mapping() { var sut = new AssemblyScanningMappingProvider(); sut.IgnoreInvalidMappers = true; sut.ReplaceDuplicateMappers = true; sut.Scan(); var actual = sut.Get <Ok>(); actual.Should().NotBeNull(); }
public void ignore_mappings_that_are_interfaces() { var sut = new AssemblyScanningMappingProvider(); sut.IgnoreInvalidMappers = true; sut.ReplaceDuplicateMappers = true; sut.Scan(); Action actual = () => sut.Get <WithInterfaceMapping>(); actual.Should().Throw <MappingNotFoundException>(); }
public void ignore_mappings_that_are_abstract() { var sut = new AssemblyScanningMappingProvider(); sut.IgnoreInvalidMappers = true; sut.ReplaceDuplicateMappers = true; sut.Scan(); Action actual = () => sut.Get <ClassThatHaveAnAbstractMapper>(); actual.Should().Throw <MappingNotFoundException>(); }
public AsyncCommandExtensionsTests() { CommandBuilderFactory.Assign(mapper => new SqliteCommandBuilder(mapper)); var provider = new AssemblyScanningMappingProvider(); provider.Scan(Assembly.GetExecutingAssembly()); EntityMappingProvider.Provider = provider; _dbFile = Path.GetTempFileName(); var cs = "URI=file:" + _dbFile; _connection = new SQLiteConnection(cs); _connection.Open(); _userTable.Create(_connection); }