public void should_execute_multi_mapping_one_to_many_relation_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 ProductModel PM INNER JOIN Product P ON PM.ProductModelID = P.ProductModelID") || msg.Contains("Retrieved 1 ProductModel entities") || msg.Contains("The first Product Model with name has 1 products") )); var multiMappingOneToManyRelationSelectStatement = new MultiMappingOneToManyRelationSelectStatement(); multiMappingOneToManyRelationSelectStatement.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); }