Ejemplo n.º 1
0
 public void XOutsideValidBoxShouldThrowArgumentOutOfRangeException2()
 {
     ShapeStub sut = new ShapeStub();
     sut.SetWidth(127990);
     Assert.Throws<ArgumentOutOfRangeException>(() => sut.SetX(11));
     //allowed x values (given a certain width value) should not throw an exception
     sut.SetX(10);
 }
Ejemplo n.º 2
0
 public void YOutsideValidBoxShouldThrowArgumentOutOfRangeException1()
 {
     ShapeStub sut = new ShapeStub();
     Assert.Throws<ArgumentOutOfRangeException>(() => sut.SetY(-1));
     Assert.Throws<ArgumentOutOfRangeException>(() => sut.SetY(1281));
     //allowed y values (given a 0 value on height) should not throw an exception
     sut.SetY(0);
     sut.SetY(1280);
 }
Ejemplo n.º 3
0
 public void XOutsideValidBoxShouldThrowArgumentOutOfRangeException1()
 {
     ShapeStub sut = new ShapeStub();
     Assert.Throws<ArgumentOutOfRangeException>(() => sut.SetX(-1));
     Assert.Throws<ArgumentOutOfRangeException>(() => sut.SetX(128001));
     //allowed x values (given a 0 value on width) should not throw an exception
     sut.SetX(0);
     sut.SetX(128000);
 }
Ejemplo n.º 4
0
        public void Expect_GetArea_ToReturn_ResultOfCalculateArea()
        {
            const double expected = 1;
            var          sut      = new ShapeStub(expected);

            var actual = sut.GetArea();

            Assert.Equal(expected, actual);
        }
Ejemplo n.º 5
0
        public void When_CalculateAreaReturnsNanOrInfinity_Expect_GetArea_ToThrow_InvalidOperationException(double calculateAreaResult)
        {
            var sut = new ShapeStub(calculateAreaResult);

            void Code()
            {
                var _ = sut.GetArea();
            }

            Assert.Throws <InvalidOperationException>(Code);
        }
Ejemplo n.º 6
0
 public void YOutsideValidBoxShouldThrowArgumentOutOfRangeException2()
 {
     ShapeStub sut = new ShapeStub();
     sut.SetHeight(1270);
     Assert.Throws<ArgumentOutOfRangeException>(() => sut.SetY(11));
     //allowed y values (given a certain height value) should not throw an exception
     sut.SetY(10);
 }
Ejemplo n.º 7
0
 public void HeightOutsideValidBoxThrowsArgumentOutOfRangeException1()
 {
     ShapeStub sut = new ShapeStub();
     Assert.Throws<ArgumentOutOfRangeException>(() => sut.SetHeight(-1));
     Assert.Throws<ArgumentOutOfRangeException>(() => sut.SetHeight(1281));
     //allowed height values (given a 0 value on y) should not throw an exception
     sut.SetHeight(0);
     sut.SetHeight(1280);
 }