Beispiel #1
0
        public void ThrowArgumentNullExceptionInBuildClocksOnNullOrEmptyTime(String time)
        {
            // Arrange
            var timeParser = new Moq.Mock <ITimeParser>();

            timeParser.Setup(parser => parser.GetTimeFromString(Moq.It.IsAny <String>())).Callback(Assert.Fail);

            var builder = new ClockBuilder(timeParser.Object);

            // Act
            builder.BuildClocks(time);
        }
Beispiel #2
0
        public void CreateBerlinClockImplClassWithProvidedTime()
        {
            // Arrange
            var timeParser = new Moq.Mock <ITimeParser>();

            timeParser.Setup(parser => parser.GetTimeFromString(Moq.It.IsAny <String>())).Returns(Time.FromInt32(123456)).Verifiable();

            var builder = new ClockBuilder(timeParser.Object);

            // Act
            IBerlinClock clock = builder.BuildClocks("Dummy");

            // Assert
            Assert.IsNotNull(clock);
            Assert.IsInstanceOfType(clock, typeof(BerlinClockImpl));
            timeParser.VerifyAll();
        }
Beispiel #3
0
        [ExpectedException(typeof(ArgumentException))] // Assert
        public void ThrowArgumentExceptionInBuildClocksOnIncorrectTimeProvided()
        {
            // Arrange
            var timeParser = new Moq.Mock <ITimeParser>();

            timeParser.Setup(parser => parser.GetTimeFromString(Moq.It.IsAny <String>())).Returns(Time.Incorrect).Verifiable();

            var builder = new ClockBuilder(timeParser.Object);

            // Act
            try
            {
                builder.BuildClocks("Dummy");
            }
            finally
            {
                timeParser.VerifyAll();
            }
        }