Пример #1
0
 public void AddEquationRelationship(IPoint from, IPoint to, PointEquation equation)
 {
     if (!(_uniqueEidConstrainer[from.Eid] is IPoint) || !(_uniqueEidConstrainer[to.Eid] is IPoint) || !(_uniqueEidConstrainer[equation.Eid] is PointEquation))
     {
         throw new KeyNotFoundException();
     }
     _graph.AddDirectedEdge(from, to, equation);
     to.Update();
 }
Пример #2
0
        public void AddEquationRelationship_InsertsIntoUnderlyingGraph()
        {
            int fromEid     = 0;
            int toEid       = 1;
            int equationEid = 2;
            var fromPoint   = A.Fake <IPoint>();

            A.CallTo(() => fromPoint.Eid).Returns(fromEid);
            var toPoint = A.Fake <IPoint>();

            A.CallTo(() => fromPoint.Eid).Returns(toEid);
            var equation = new PointEquation(equationEid, null);

            _pointGraph.AddPoint(fromPoint);
            _pointGraph.AddPoint(toPoint);
            _pointGraph.AddEquation(equation);

            _pointGraph.AddEquationRelationship(fromPoint, toPoint, equation);

            A.CallTo(() => _underlyingDirectedGraph.AddDirectedEdge(fromPoint, toPoint, equation)).MustHaveHappened();
        }