public void TimeConversion_BothConvertToAndFromAreIncorrectUnit_ReturnArgumentException()
        {
            string convertFrom = "minumutes";
            string convertTo   = "shecondssess";
            double time        = 2.00;

            Assert.That(() => TimeConversion.Convert(time, convertFrom, convertTo), Throws.ArgumentException);
        }
        public void TimeConversion_BothConvertToAndFromAreCorrect_DoesNotReturnArgumentException()
        {
            string convertFrom = "Minutes";
            string convertTo   = "Seconds";
            double time        = 2.00;

            Assert.That(() => TimeConversion.Convert(time, convertFrom, convertTo), !Throws.ArgumentException);
        }
        public void TimeConversion_ConvertFromIncorrectUnit_ReturnArgumentException()
        {
            string convertFrom = "minimuntess";
            string convertTo   = "Hours";
            double time        = 2.00;

            Assert.That(() => TimeConversion.Convert(time, convertFrom, convertTo), Throws.ArgumentException);
        }
Example #4
0
        public void TimeConversion_5MinutesToEmptyString_NoExceptionsThrown()
        {
            //arrange
            double userInputTime  = -5;
            string convertFrom    = "Minutes";
            string convertTo      = string.Empty;
            double expectedResult = 0;
            //assert
            double actualResult = TimeConversion.Convert(userInputTime, convertFrom, convertTo);

            //act
            Assert.AreEqual(expectedResult, actualResult);
        }
Example #5
0
        public void TimeConversion_5EmptyStringToSeconds_NoExceptionsThrown()
        {
            //arrange
            double userInputTime  = 5;
            string convertFrom    = string.Empty;
            string convertTo      = "Seconds";
            double expectedResult = 0;
            //assert
            double actualResult = TimeConversion.Convert(userInputTime, convertFrom, convertTo);

            //act
            Assert.AreEqual(expectedResult, actualResult);
        }