예제 #1
0
        public void Has(HasStepType pStepType)
        {
            OneKnowsTwo result = DoHasStep <OneKnowsTwo, One>(pStepType, x => x.A);

            Assert.NotNull(result, "Result should be filled.");
            vMockPath.Verify(x => x.AddItem(It.IsAny <WeaverStepHas <One> >()), Times.Once());
        }
예제 #2
0
        /*--------------------------------------------------------------------------------------------*/
        private TEdge DoHasStep <TEdge, TVert>(HasStepType pStepType,
                                               Expression <Func <TVert, object> > pProperty)
            where TEdge : IWeaverEdge, new()
            where TVert : IWeaverVertex, new()
        {
            var edge = new TEdge();

            edge.Path = vMockPath.Object;

            switch (pStepType)
            {
            case HasStepType.HasOp:
                return(edge.HasVci(pProperty, WeaverStepHasOp.EqualTo, 1));

            case HasStepType.HasProp:
                return(edge.HasVci(pProperty));

            case HasStepType.HasNotOp:
                return(edge.HasNotVci(pProperty, WeaverStepHasOp.EqualTo, 1));

            case HasStepType.HasNotProp:
                return(edge.HasNotVci(pProperty));
            }

            throw new Exception("Unknown type: " + pStepType);
        }
예제 #3
0
        public void HasInvalidVertex(HasStepType pStepType)
        {
            Exception e = WeaverTestUtil.CheckThrows <WeaverException>(true, () =>
                                                                       DoHasStep <OneKnowsTwo, Person>(pStepType, x => x.Name));

            bool correct = (e.Message.Contains(typeof(Person).Name) &&
                            e.Message.Contains(typeof(WeaverTitanVertexAttribute).Name));

            Assert.True(correct, "Incorrect exception: " + e);
        }
예제 #4
0
        public void HasNonVciProperty(HasStepType pStepType)
        {
            Exception e = WeaverTestUtil.CheckThrows <WeaverException>(true, () =>
                                                                       DoHasStep <OneKnowsTwo, One>(pStepType, x => x.B));

            bool correct = (e.Message.Contains(typeof(OneKnowsTwo).Name) &&
                            e.Message.Contains(typeof(One).Name + ".B"));

            Assert.True(correct, "Incorrect exception: " + e);
        }
예제 #5
0
        public void HasInvalidVertexType(HasStepType pStepType)
        {
            Exception e = WeaverTestUtil.CheckThrows <WeaverException>(true, () =>
                                                                       DoHasStep <OneKnowsTwo, NullableProp>(pStepType, x => x.NonTitanAttribute));

            bool correct = (e.Message.Contains(typeof(NullableProp).Name) &&
                            e.Message.Contains("not valid for edge type"));

            Assert.True(correct, "Incorrect exception: " + e);
        }
예제 #6
0
        public void HasInvalidProperty(HasStepType pStepType)
        {
            Exception e = WeaverTestUtil.CheckThrows <WeaverException>(true, () =>
                                                                       DoHasStep <OneKnowsThree, Three>(pStepType, x => x.B));

            bool correct = (e.Message.Contains(typeof(WeaverTitanPropertyAttribute).Name) &&
                            e.Message.Contains("B"));

            Assert.True(correct, "Incorrect exception: " + e);
        }