コード例 #1
0
        public void HorizontalArrowClass_DrawAtMethod_ThrowsArgumentNullException_IfFirstParameterIsNull()
        {
            double          testParam1 = _rnd.NextDouble() * 100;
            double          testParam2 = _rnd.NextDouble() * 100;
            HorizontalArrow testObject = GetArrow();

            testObject.DrawAt(null, testParam1, testParam2);

            Assert.Fail();
        }
コード例 #2
0
        public void HorizontalArrowClass_DrawAtMethod_CallsDrawFilledPolygonMethodOfFirstParameter()
        {
            Mock <IGraphicsContext> mockGraphicsContext = new Mock <IGraphicsContext>();
            double          testParam1 = _rnd.NextDouble() * 100;
            double          testParam2 = _rnd.NextDouble() * 100;
            HorizontalArrow testObject = GetArrow();

            testObject.DrawAt(mockGraphicsContext.Object, testParam1, testParam2);

            mockGraphicsContext.Verify(c => c.DrawFilledPolygon(It.IsAny <IEnumerable <UniPoint> >()));
        }
コード例 #3
0
        public void HorizontalArrowClass_DrawAtMethod_CallsDrawFilledPolygonMethodOfFirstParameterWithParameterContainingPoints()
        {
            List <UniPoint>         capturedPointList   = null;
            Mock <IGraphicsContext> mockGraphicsContext = new Mock <IGraphicsContext>();

            mockGraphicsContext.Setup(c => c.DrawFilledPolygon(It.IsAny <IEnumerable <UniPoint> >())).Callback <IEnumerable <UniPoint> >(e => { capturedPointList = e.ToList(); });
            double          testParam1 = _rnd.NextDouble() * 100;
            double          testParam2 = _rnd.NextDouble() * 100;
            HorizontalArrow testObject = GetArrow();

            testObject.DrawAt(mockGraphicsContext.Object, testParam1, testParam2);

            Assert.IsTrue(capturedPointList.Any(p => p != null));
        }
コード例 #4
0
        public void HorizontalArrowClass_DrawAtMethod_ThrowsArgumentNullExceptionWithCorrectParamNameProperty_IfFirstParameterIsNull()
        {
            double          testParam1 = _rnd.NextDouble() * 100;
            double          testParam2 = _rnd.NextDouble() * 100;
            HorizontalArrow testObject = GetArrow();

            try
            {
                testObject.DrawAt(null, testParam1, testParam2);
                Assert.Fail();
            }
            catch (ArgumentNullException ex)
            {
                Assert.AreEqual("context", ex.ParamName);
            }
        }
コード例 #5
0
        public void HorizontalArrowClass_DrawAtMethod_CallsDrawFilledPolygonMethodWithNoPointsWithAGreaterYCoordinateThanTheThirdParameterToTheOriginalMethodPlusTheArrowHeightProperty()
        {
            List <UniPoint>         capturedPointList   = null;
            Mock <IGraphicsContext> mockGraphicsContext = new Mock <IGraphicsContext>();

            mockGraphicsContext.Setup(c => c.DrawFilledPolygon(It.IsAny <IEnumerable <UniPoint> >())).Callback <IEnumerable <UniPoint> >(e => { capturedPointList = e.ToList(); });
            double          testParam1 = _rnd.NextDouble() * 100;
            double          testParam2 = _rnd.NextDouble() * 100;
            HorizontalArrow testObject = GetArrow();

            testObject.DrawAt(mockGraphicsContext.Object, testParam1, testParam2);

            foreach (UniPoint point in capturedPointList)
            {
                Assert.IsTrue(point.Y - (testParam2 + testObject.Height) < 0.0000000001);
            }
        }