Пример #1
0
        public void GetPoints_Should_Return_All_Segment_Points()
        {
            var figure = _factory.CreatePathFigure();

            var segment1 = new TestSegment()
            {
                Point = _factory.CreatePointShape()
            };

            figure.Segments = figure.Segments.Add(segment1);

            var segment2 = new TestSegment()
            {
                Point = _factory.CreatePointShape()
            };

            figure.Segments = figure.Segments.Add(segment2);

            var target = figure.GetPoints();

            Assert.Equal(3, target.Count());

            Assert.Contains(figure.StartPoint, target);
            Assert.Contains(segment1.Point, target);
            Assert.Contains(segment2.Point, target);
        }
        public TestSegment GetSegment(string Id)
        {
            TestSegment returnVal = null;

            if (HasSegment(Id))
            {
                returnVal = Segments[Id];
            }
            return(returnVal);
        }
        public bool AddTestSegment(TestSegment segment)
        {
            bool added = false;

            if (!Segments.ContainsKey(segment.ID) ||
                !segmentsList.Contains(segment))
            {
                //add the segment to both the dictionary and the list
                segments[segment.ID] = segment;
                segmentsList.Add(segment);
                added = true;
            }
            return(added);
        }
Пример #4
0
        public void PipelineBuilder_DoByVersion_AddsSegmentToPipeline()
        {
            var          segment            = new TestSegment();
            const string pipelineName       = "Pipeline";
            var          pipeline           = new Mock <IPipeline>();
            var          pipelineRepository = new Mock <IPipelineRepository>();

            pipelineRepository.Setup(r => r.CreateNew(pipelineName)).Returns(pipeline.Object);
            var segmentRunner        = new Mock <ISegmentRunner>();
            var segmentRunnerFactory = new Mock <ISegmentRunnerFactory>();

            segmentRunnerFactory.Setup(f => f.CreateVersionedRunner(segment)).Returns(segmentRunner.Object);

            new PipelineBuilder(pipelineName, pipelineRepository.Object, segmentRunnerFactory.Object).
            DoByVersion(segment);

            pipelineRepository.Verify(r => r.CreateNew(pipelineName));
            pipeline.Verify(p => p.AddSegmentRunner(segmentRunner.Object));
        }