public void should_execute_multi_mapping_select_statement() { var inMemoryDatabase = new InMemoryDatabase(); inMemoryDatabase.Insert <Product>(new List <Product> { new Product("987", "123") }); inMemoryDatabase.Insert <ProductModel>(new List <ProductModel> { new ProductModel("987", "123") }); var mockRepo = new MockRepository(MockBehavior.Default); var loggerMock = mockRepo.Create <ILogger>(); loggerMock.Setup(a => a.WriteLine(It.IsAny <string>())) .Callback <string>(msg => Assert.IsTrue( msg.Contains("SELECT * FROM Product P INNER JOIN ProductModel PM ON P.ProductModelID = PM.ProductModelID") || msg.Contains("Retrieved 1 products") || msg.Contains("First Product with name is model of type ") )); var multiMappingSelectStatement = new MultiMappingSelectStatement(); multiMappingSelectStatement.Execute(inMemoryDatabase.OpenConnection(), loggerMock.Object); }
/// <summary> /// Gets the sample. /// </summary> /// <param name="sampleType">Type of the sample.</param> /// <returns></returns> public static ISamples GetSample(SampleTypes sampleType) { ISamples sample = null; switch (sampleType) { case SampleTypes.SimpleSelectStatement: sample = new SimpleSelectStatement(); break; case SampleTypes.SimpleSelectStatementWithDynamicEntities: sample = new SimpleSelectStatementWithDynamicEntities(); break; case SampleTypes.MultiMappingSingleEntity: sample = new MultiMappingSelectStatement(); break; case SampleTypes.MultiMappingChildEntities: sample = new MultiMappingOneToManyRelationSelectStatement(); break; case SampleTypes.ParameterizedSelectStatement: sample = new ParameterizedSelectStatement(); break; case SampleTypes.MultipleQueries: sample = new MultipleQueries(); break; case SampleTypes.SimpleStoredProcedure: sample = new SimpleStoredProcedure(); break; case SampleTypes.SimpleInsertStatement: sample = new SimpleInsertStatement(); break; default: break; } return(sample); }