Ejemplo n.º 1
0
        public bool IsLeapYear_WithGivenTestCasesExpectedResult_TheResultShouldBeCorrect(int year)
        {
            //arrange
            var bm = new BoolMethods();

            //assert
            return(bm.IsLeapYear(year));
        }
        public void BoolMethod_TheYeasIsNegative_ShouldThrowsException()
        {
            //Arrange
            var year = -1503;
            var vm   = new BoolMethods();

            //Act + Assertsss
            Assert.Catch <Exception>(() => vm.IsLeapYear(year));
        }
        public void IsLeapYear_YearIsNegative_ShouldCatchArgumentException()
        {
            //Arrange
            var bm   = new BoolMethods();
            var year = -1997;

            //Act+Assert
            Assert.Catch <Exception>(() => bm.IsLeapYear(year));
        }
Ejemplo n.º 4
0
        public void IsLeapYear_WithGivenTestCases_TheResultShouldBeCorrect(int year, bool expectedResult)
        {
            //arrange
            var bm = new BoolMethods();
            //act
            var result = bm.IsLeapYear(year);

            //assert
            Assert.AreEqual(result, expectedResult);
        }
Ejemplo n.º 5
0
        public void IsLeapYear_YearIsZero_ShouldThrowArgumentException()
        {
            //arrange
            var bm   = new BoolMethods();
            var year = 0;

            //act
            //assert
            Assert.Throws <ArgumentException>(() => bm.IsLeapYear(year));
        }
Ejemplo n.º 6
0
        public void IsLeapYear_SequentialValuesYear_TheResultShouldBeCorrect([Values(1996, 1997, 1998)] int year, [Values(true, false, false)] bool expectedResult)
        {
            //arrange
            var bm = new BoolMethods();

            //act
            var result = bm.IsLeapYear(year);

            //assert
            Assert.AreEqual(result, expectedResult);
        }
        public void BoolMethod_TheYeasIsNegative_ShouldThrowsArgumentException()
        {
            //Arrange
            var year = -1503;
            var vm   = new BoolMethods();

            //Act + Assertsss
            //Assert.Throws<ArgumentException>(() => vm.IsLeapYear(year));
            Action result = () => vm.IsLeapYear(year);

            result.Should().Throw <ArgumentException>();
        }
        public void BoolMethod_TheYearIsLeap_TheReturnedResultShouldBeTrue()
        {
            //Arrange
            var vm = new BoolMethods();

            //Act
            var result = vm.IsLeapYear(1996);

            //Assert
            //Assert.IsTrue(result);
            result.Should().BeTrue();
        }
Ejemplo n.º 9
0
        public void IsLeapYear_YearIsNotLeap_TheResultShouldBeFalse()
        {
            //arrange
            var bm   = new BoolMethods();
            var year = 1997;

            //act
            var result = bm.IsLeapYear(year);

            //assert
            Assert.IsFalse(result);
        }
        public void IsLeapYear_YearIsNegative_ShouldThrowArgumentException()
        {
            //Arrange
            var bm   = new BoolMethods();
            var year = -1997;

            //Act+Assert
            //Assert.Throws<ArgumentException>(() => bm.IsLeapYear(year));
            Action result = () => bm.IsLeapYear(year);

            result.Should().Throw <ArgumentException>();
        }
        public void BoolMethod_TheYeasIsNotLeap_TheReturnedResultShouldBeFalse()
        {
            //Arrange
            var year = 1997;
            var vm   = new BoolMethods();

            //Act
            var result = vm.IsLeapYear(year);

            //Assert
            //Assert.IsFalse(result);
            result.Should().BeFalse();
        }
        public void IsLeapYear_YearIsNotLeap_TheResultShouldBeFalse()
        {
            //Arrange
            var bm   = new BoolMethods();
            var year = 1997;

            //Act
            var result = bm.IsLeapYear(year);

            //Assert
            //Assert.False(result);
            result.Should().BeFalse();
        }
        public void BoolMethod_TheYeasIsNegative_ShouldThrowsArgumentExceptionCase1()
        {
            //Arrange
            var expectedExceptionMsg = "Year must be positive number";
            var year = -1503;
            var vm   = new BoolMethods();

            //Act + Assertsss
            //var result = Assert.Throws<ArgumentException>(() => vm.IsLeapYear(year));
            //Assert.AreEqual(expectedExceptionMsg, result.Message);
            Action result = () => vm.IsLeapYear(year);

            result.Should().Throw <ArgumentException>().WithMessage(expectedExceptionMsg);
            //result.Should().Throw<ArgumentException>().WithInnerException<xx>().WithMessage(expectedExceptionMsg);
        }
 public void Init()
 {
     bm = new BoolMethods();
 }
Ejemplo n.º 15
0
 public void Setup()
 {
     bm = new BoolMethods();
 }