Beispiel #1
0
        public void TestFakeDateReturnsGivenHour()
        {
            //Arrange
            int   expectedHour = 10;
            IDate fakeDate     = new FakeDate(expectedHour, DayOfWeek.Tuesday);
            //Act
            int actualHour = fakeDate.Date.Hour;

            //Assert
            Assert.AreEqual(expectedHour, actualHour);
        }
Beispiel #2
0
        public void TestFakeDateReturnsGivenDayOfWeek()
        {
            //Arrange
            DayOfWeek expectedDay = DayOfWeek.Tuesday;
            IDate     fakeDate    = new FakeDate(9, expectedDay);
            //Act
            DayOfWeek actualDay = fakeDate.Date.DayOfWeek;

            //Assert
            Assert.AreEqual(expectedDay, actualDay);
        }
        public void TestGetHelloMessageReturnsCorrectMessageForMondayMorning()
        {
            //Arrange
            IDate   fakeDate        = new FakeDate(9, DayOfWeek.Monday);
            string  userName        = "******";
            IUser   fakeUser        = new FakeUser(userName);
            Message message         = new Message(fakeUser, fakeDate);
            string  expectedMessage = "Good morning " + userName + "\r\nIt's " + DayOfWeek.Monday + ", 9 o'clock";
            //Act
            string actualMessage = message.HelloMessage;

            //Assert
            Assert.AreEqual(expectedMessage, actualMessage);
        }
        public void TestGetHelloReturnsCorrectMessageForWeekEnd()
        {
            //Arrange
            string  expectedHello = "Good week-end ";
            IDate   fakeDate      = new FakeDate(5, DayOfWeek.Saturday);
            string  userName      = "******";
            IUser   fakeUser      = new FakeUser(userName);
            Message message       = new Message(fakeUser, fakeDate);
            //Act
            string actualHello = message.GetHello();

            //Assert
            Assert.AreEqual(expectedHello, actualHello);
        }
        public void TestGetHelloReturnsCorrectMessageForTuesdayAfternoon()
        {
            //Arrange
            string  expectedHello = "Good afternoon ";
            IDate   fakeDate      = new FakeDate(13, DayOfWeek.Tuesday);
            string  userName      = "******";
            IUser   fakeUser      = new FakeUser(userName);
            Message message       = new Message(fakeUser, fakeDate);
            //Act
            string actualHello = message.GetHello();

            //Assert
            Assert.AreEqual(expectedHello, actualHello);
        }