public void FindParent_IfIsTypeGeneratioNContextNode_AndParentNotType_ReturnNull()
        {
            IdSameAsParentDataSource<TestModel, System.Guid> source =
                new IdSameAsParentDataSource<TestModel, System.Guid>(a => a.Id);

            TypeGenerationContextNode node = new TypeGenerationContextNode(null, "Test Object as String");

            Assert.IsNull(source.FindParent(node), @"
            FindParent should return null if the given node is a TypeGenerationContextNode but it's Target is not of the given type.
            ");
        }
        public void FindParent_IfIsTypeGenerationContextNode_AndParentIsType_ReturnParent()
        {
            TestModel target = new TestModel();
            IdSameAsParentDataSource<TestModel, System.Guid> source =
                new IdSameAsParentDataSource<TestModel, System.Guid>(a => a.Id);

            TypeGenerationContextNode node = new TypeGenerationContextNode(null, target);

            Assert.AreEqual(target, source.FindParent(node), @"
            FindParent should return it's Target if the given node is a TypeGenerationContextNode and it's Target is of the
            specified type.
            ");
        }
        public void FindParent_NestedTest()
        {
            TestModel target = new TestModel();
            IdSameAsParentDataSource<TestModel, System.Guid> source =
                new IdSameAsParentDataSource<TestModel, System.Guid>(a => a.Id);

            DummyGenerationContextNode root = new DummyGenerationContextNode();
            TypeGenerationContextNode targetNode = new TypeGenerationContextNode(root, target);
            DummyGenerationContextNode leafNode = new DummyGenerationContextNode(GenerationTargetTypes.Object, targetNode);

            Assert.AreEqual(target, source.FindParent(leafNode), @"
            Target should have been returned.  A TypeGenerationContextNode with a Target of type TestModel was the parent of the node passed to FindParent.
            ");
        }
 public TypeMethodGenerationContextNode(TypeGenerationContextNode parent, EngineTypeMethodMember method)
 {
     mParent = parent;
     mMethod = method;
 }
 public TypePropertyGenerationContextNode(TypeGenerationContextNode parent, EngineTypePropertyMember property)
 {
     mParent   = parent;
     mProperty = property;
 }
 public TypeMethodGenerationContextNode(TypeGenerationContextNode parent, EngineTypeMethodMember method)
 {
     mParent = parent;
     mMethod = method;
 }
 public TypePropertyGenerationContextNode(TypeGenerationContextNode parent, EngineTypePropertyMember property)
 {
     mParent = parent;
     mProperty = property;
 }
Exemple #8
0
 public TypeFieldGenerationContextNode(TypeGenerationContextNode parent, EngineTypeFieldMember field)
 {
     mParent = parent;
     mField  = field;
 }
        public void Next()
        {
            TestModel target = new TestModel() { Id = System.Guid.NewGuid() };
            IdSameAsParentDataSource<TestModel, System.Guid> source =
                new IdSameAsParentDataSource<TestModel, System.Guid>(a => a.Id);

            TypeGenerationContextNode node = new TypeGenerationContextNode(null, target);
            Mock<IGenerationContext> contextMock = new Mock<IGenerationContext>();
            contextMock.Setup(a => a.Node).Returns(node);

            Assert.AreEqual(target.Id, source.Next(contextMock.Object), @"
            The result should be the value of the Id property of our target.
            ");
        }
 public TypeFieldGenerationContextNode(TypeGenerationContextNode parent, EngineTypeFieldMember field)
 {
     mParent = parent;
     mField = field;
 }