public void HorizontalArrowClass_FlipMethod_ReturnsObjectWithSameHeight() { HorizontalArrow testObject = GetArrow(); HorizontalArrow testOutput = testObject.Flip(); Assert.AreEqual(testOutput.Height, testObject.Height); }
public void HorizontalArrowClass_FlipMethod_ReturnsObjectWithSameStemThickness() { HorizontalArrow testObject = GetArrow(); HorizontalArrow testOutput = testObject.Flip(); Assert.AreEqual(testOutput.StemThickness, testObject.StemThickness); }
public void HorizontalArrowClass_FlipMethod_ReturnsDifferentObject() { HorizontalArrow testObject = GetArrow(); HorizontalArrow testOutput = testObject.Flip(); Assert.AreNotSame(testOutput, testObject); }
public void HorizontalArrowClass_FlipMethod_ReturnsObjectWithDirectionPropertyToLeft_IfDirectionPropertyEqualsToRight() { HorizontalArrow testObject = GetArrow(HorizontalDirection.ToRight); HorizontalArrow testOutput = testObject.Flip(); Assert.AreEqual(HorizontalDirection.ToLeft, testOutput.Direction); }
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(); }
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> >())); }
public void HorizontalArrowClass_Constructor_FourthParameterSetsHeadBreadthProperty() { HorizontalDirection testParam0 = _rnd.NextBoolean() ? HorizontalDirection.ToLeft : HorizontalDirection.ToRight; double testParam1 = _rnd.NextDouble() * 100; double testParam2 = _rnd.NextDouble() * 100; double testParam3 = _rnd.NextDouble() * 100; double testParam4 = _rnd.NextDouble() * 100; double testParam5 = _rnd.NextDouble() * 100; HorizontalArrow testObject = new HorizontalArrow(testParam0, testParam1, testParam2, testParam3, testParam4, testParam5); Assert.AreEqual(testParam3, testObject.HeadBreadth); }
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)); }
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); } }
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); } }