public void Given_Invalid_Time_Then_An_Argument_Exception_Should_Be_Thrown()
        {
            void ActionWrapper()
            {
                // Arrange
                var aTime = "28:00:02";

                Mock.Get(_timeValidator).Setup(s => s.IsValidTime(aTime)).Returns(false);

                // Act
                _itemUnderTest.ConvertTime(aTime);
            }

            Assert.Throws(typeof(ArgumentException), ActionWrapper);
        }
Beispiel #2
0
        public string BerlinClockOutput(string time)
        {
            ITimeConverter outputFormat = factory.ConvertTime(time);
            string         output       = outputFormat.ConvertTime(inputTime);

            return(output);
        }
Beispiel #3
0
 public void WhenTheTimeIs(string time)
 {
     try
     {
         convertedTime = berlinClock.ConvertTime(time);
     }
     catch (Exception e)
     {
         ScenarioContext.Current.Add(e.Message, e);
     }
 }
Beispiel #4
0
        public ActionResult <string> Get()
        {
            try
            {
                var time = DateTime.UtcNow.ToString("HH:mm:ss");

                return(_timeConverter.ConvertTime(time));
            }
            catch (Exception e)
            {
                _logger.LogError(e, "UtcTime conversion failed");

                return(new StatusCodeResult(StatusCodes.Status500InternalServerError));
            }
        }
Beispiel #5
0
 public void ThenTheClockShouldLookLike(string theExpectedBerlinClockOutput)
 {
     Assert.AreEqual(theExpectedBerlinClockOutput, _berlinClock.ConvertTime(_theTime));
 }
        public void ThenTheClockShouldLookLike(string theExpectedBerlinClockOutput)
        {
            var theExpectedBerlinClockOutputFormatted = Regex.Replace(theExpectedBerlinClockOutput, @"\r\n?|\n", Environment.NewLine);

            Assert.AreEqual(_berlinClock.ConvertTime(_theTime), theExpectedBerlinClockOutputFormatted, true);
        }
        public void ThenTheClockShouldLookLike(string theExpectedBerlinClockOutput)
        {
            string currentBerlinClockOutput = berlinClock.ConvertTime(theTime);

            Assert.AreEqual(currentBerlinClockOutput, theExpectedBerlinClockOutput);
        }
Beispiel #8
0
        public void ThenTheClockShouldLookLike(string theExpectedBerlinClockOutput)
        {
            var actualBerlinClockTime = _timeConverter.ConvertTime(_theTime);

            Assert.AreEqual(actualBerlinClockTime, theExpectedBerlinClockOutput);
        }
Beispiel #9
0
 public void ThenTheClockShouldLookLike(string theExpectedBerlinClockOutput)
 {
     Assert.AreEqual(_BerlinClock.ConvertTime(_TimeToConvert), theExpectedBerlinClockOutput);
 }
 public void ThenTheClockShouldLookLike(string theExpectedBerlinClockOutput)
 {
     //I've switched parameters, to have first expected and than actual as method signature suggest
     Assert.AreEqual(theExpectedBerlinClockOutput, berlinClock.ConvertTime(theTime));
 }
 public string ConvertTime_ValidTime_Converted(string time)
 {
     return(_berlinClock.ConvertTime(time));
 }
 public void ShouldConvert()
 {
     Assert.That(timeConverter.ConvertTime(TimeAsString), Is.EqualTo(ExpectedOutput));
 }