public void Greeting( int hour, int minute, int second, string userName, string expectedGreeting) { IClock clock = new StoppedClock(new DateTimeOffset( new DateTime(2018, 1, 1, hour, minute, second), TimeSpan.FromHours(-2))); var sut = new DefaultGreetingService(clock); Assert.AreEqual(expectedGreeting, sut.Greet(userName)); }
public void Greeting_WithInvalidName_Throws() { IClock clock = new StoppedClock(new DateTimeOffset( new DateTime(2018, 1, 1, 14, 15, 0), TimeSpan.FromHours(-2))); var sut = new DefaultGreetingService(clock); Assert.Multiple(() => { Assert.Throws <ArgumentException>(() => sut.Greet(null)); Assert.Throws <ArgumentException>(() => sut.Greet(string.Empty)); Assert.Throws <ArgumentException>(() => sut.Greet(" ")); Assert.Throws <ArgumentException>(() => sut.Greet("\n\n\t")); }); }