public IConnectionstringArgumentsMapper Make(string databaseType) { IConnectionstringArgumentsMapper connectionstringArgumentsMapper; switch (databaseType.ToUpper()) { case "SQLSERVER": connectionstringArgumentsMapper = new SqlServerConnectionstringArgumentsMapper(); break; case "ACCESS": connectionstringArgumentsMapper = new AccessConnectionstringArgumentsMapper(); break; default: throw new ArgumentException(); } return connectionstringArgumentsMapper; }
public void SetUp() { _session = MockRepository.GenerateStrictMock<HttpSessionStateBase>(); _session.Stub(s => s["Connectionstring"]).Return(Connectionstring); _context = MockRepository.GenerateStrictMock<HttpContextBase>(); _context.Stub(c => c.Session).Return(_session); _connectionstringBuilder = MockRepository.GenerateStub<IConnectionstringBuilder>(); _connectionstringBuilder.Expect(cb => cb.BuildConnectionString(Arg<IConnectionstringArguments>.Is.Anything)).Return(Connectionstring); var sqlServerConnectionstringArgumentsMapper = new SqlServerConnectionstringArgumentsMapper(); _connectionstringArgumentsMapperFactory = MockRepository.GenerateStrictMock<IConnectionstringArgumentsMapperFactory>(); _connectionstringArgumentsMapperFactory.Expect(factory => factory.Make(Arg<string>.Is.Anything)).Return(sqlServerConnectionstringArgumentsMapper); _schemaReader = MockRepository.GenerateStub<ISchemaReader>(); }