public void TestEnumerationAutoColumn() { var property1 = "zip"; var property2 = "location"; var property3 = "other"; var mofObject = new MofObject(); mofObject.set(property1, "55130"); mofObject.set(property2, "Mainz"); var mofObject2 = new MofObject(); mofObject2.set(property1, "65474"); mofObject2.set(property2, "Bischofsheim"); var enumeration = new MofReflectiveSequence(); enumeration.add(new MofObject()); mofObject2.set(property3, enumeration); var extent = new MofUriExtent("datenmeister:///test"); extent.elements().add(mofObject); extent.elements().add(mofObject2); // Execute the stuff var creator = new ColumnCreator(null, null, null); var result = creator.FindColumnsForTable(extent); Assert.That(result, Is.Not.Null); Assert.That(result.Columns.Count(), Is.EqualTo(3)); var firstColumn = result.Columns.FirstOrDefault(x => x.name == "zip"); var secondColumn = result.Columns.FirstOrDefault(x => x.name == "location"); var thirdColumn = result.Columns.FirstOrDefault(x => x.name == "other"); Assert.That(firstColumn, Is.Not.Null); Assert.That(secondColumn, Is.Not.Null); Assert.That(firstColumn.isEnumeration, Is.False); Assert.That(secondColumn.isEnumeration, Is.False); Assert.That(thirdColumn.isEnumeration, Is.True); }
private MofReflectiveSequence CreateReflectiveSequence() { var reflectiveSequence = new MofReflectiveSequence(); var value = new MofObject(); value.set(property1, 3); value.set(property3, "A"); // A = 3 reflectiveSequence.add(value); value = new MofObject(); value.set(property1, 1); value.set(property3, "B"); // A = 3, B = 1 reflectiveSequence.add(value); value = new MofObject(); value.set(property1, 2); value.set(property3, "A"); // A = 5, B = 1 reflectiveSequence.add(value); value = new MofObject(); value.set(property1, 3); value.set(property3, "B"); // A = 5, B = 4 reflectiveSequence.add(value); value = new MofObject(); value.set(property1, 4); value.set(property2, 4); value.set(property3, "A"); // A = 9, B = 4 reflectiveSequence.add(value); value = new MofObject(); value.set(property2, 3); reflectiveSequence.add(value); return reflectiveSequence; }