public void When_Greeted_In_The_Morning_Returns_MorningView()
        {
            //Arrage
            var fakeGreeter = new FakeGreeter();
            var fakeDateTimeServiceForMorning = new FakeDateTimeServiceForMorning();
            var controller = new GreeterController(fakeGreeter, fakeDateTimeServiceForMorning);
            var expectedViewName = "MorningView";
            var greetInput = new GreetInput();
            //Act
            var result = controller.Greet(greetInput);

            //Assert
            Assert.AreEqual(expectedViewName, result.ViewName);
        }
        public void When_Greeted_GreeterMessage_Is_Rendered()
        {
            //Arrange
            var fakeGreeter = new FakeGreeter();
            var fakeDateTimeServiceForMorning = new FakeDateTimeServiceForMorning();
            var controller = new GreeterController(fakeGreeter, fakeDateTimeServiceForMorning);
            var expectedMessage = fakeGreeter.Greet();
            var greetInput = new GreetInput();
            //Act
            var viewResult = controller.Greet(greetInput);

            //Assert
            Assert.AreEqual(expectedMessage, viewResult.ViewData["message"]);
        }
        public void Returns_Afternoon_View_After_12()
        {
            //Arrange
            var dateTimeMockery = new Mock<IDateTimeService>();
            dateTimeMockery.Setup(s => s.GetCurrent()).Returns(new DateTime(2016, 1, 10, 15, 0, 0));
            var _dateTimeServiceMock = dateTimeMockery.Object;

            var greeterServiceMockery = new Mock<IGreeterService>();
            var _greeterServiceMock = greeterServiceMockery.Object;

            var sut = new GreeterController(_greeterServiceMock, _dateTimeServiceMock);
            var expecedViewName = "AfternoonView";

            //Act
            var result = sut.Greet(new GreetInput() {FirstName = "Magesh", LastName = "Kuppan"});

            //Assert
            Assert.AreEqual(expecedViewName, result.ViewName);
        }
        public void Views_Receive_Message_When_Greeted()
        {
            //Arrange
            var dateTimeMockery = new Mock<IDateTimeService>();
            dateTimeMockery.Setup(s => s.GetCurrent()).Returns(new DateTime(2016, 1, 10, 15, 0, 0));
            var _dateTimeServiceMock = dateTimeMockery.Object;

            var greeterServiceMockery = new Mock<IGreeterService>();
            greeterServiceMockery.Setup(s => s.Greet(Moq.It.IsAny<string>())).Returns("Dummy message");
            
            var _greeterServiceMock = greeterServiceMockery.Object;

            var sut = new GreeterController(_greeterServiceMock, _dateTimeServiceMock);
            var name = "Magesh";
            var expecedMessage = "Dummy message";

            //Act
            var result = sut.Greet(new GreetInput() {FirstName = "Magesh", LastName = "Kuppan"});
        
            //Assert
            //_greeterServiceMock.Greet(It.IsAny<string>()).]
            greeterServiceMockery.Verify(s => s.Greet("Magesh Kuppan"), Times.Once);
            Assert.AreEqual(expecedMessage, result.ViewBag.Message);
        }