コード例 #1
0
        public void AddNewObjectWithValueType()
        {
            var graph          = new ReachabilityGraph();
            var mockExpression = new Mock <INewObjectExpression>();

            mockExpression.Setup(e => e.DataType).Returns(DataType.Int);

            var temp = graph.AddObject(mockExpression.Object);

            Assert.Null(temp);
            Assert.Empty(graph.ReferenceGraph.Objects);
            Assert.Empty(graph.ReferenceGraph.TempValues);
        }
コード例 #2
0
        public void AddNewObject()
        {
            var graph          = new ReachabilityGraph();
            var mockExpression = new Mock <INewObjectExpression>();
            // TODO this type should be Isolated or Owned
            var fakeReferenceType = new ObjectType(NamespaceName.Global, "Fake", false, ReferenceCapability.Shared);

            mockExpression.Setup(e => e.DataType).Returns(fakeReferenceType);

            var temp = graph.AddObject(mockExpression.Object);

            Assert.NotNull(temp);
            Assert.Collection(graph.ReferenceGraph.Objects, o =>
            {
                Assert.Equal(mockExpression.Object, o.OriginSyntax);
                Assert.Single(temp !.PossibleReferents, o);
                // TODO what else to test
            });