public void About()
        {
            // Arrange
            HomeController controller = new HomeController();
            IAnnouncementService announcemsntServiceStub = new StubIAnnouncementService()
            {
                GetAnnouncements = () =>
                {
                    return new List<Announcement>()
                    {
                        new Announcement() {Title = "announcement1"},
                        new Announcement() {Title = "announcement1"}
                    };
                }
            };

            controller.AnnouncementService = announcemsntServiceStub;
            // Act
            ViewResult result = controller.About() as ViewResult;

            // Assert
            Assert.AreEqual("Your application description page.", result.ViewBag.Message);
            Assert.AreEqual(typeof(List<Announcement>), result.Model.GetType());
            Assert.AreEqual(2, ((ICollection<Announcement>)result.Model).Count);
        }
        public void About()
        {
            // Arrange
            HomeController controller = new HomeController();

            // Act
            ViewResult result = controller.About() as ViewResult;

            // Assert
            Assert.AreEqual("Your application description page.", result.ViewBag.Message);
        }
        public void About_Moq()
        {
            // Arrange
            var fakeAgengies = new List<Announcement>()
                    {
                        new Announcement() {Title = "announcement1"},
                        new Announcement() {Title = "announcement1"}
                    };

            HomeController controller = new HomeController();

            Mock<IAnnouncementService> announcemsntServiceMock = new Mock<IAnnouncementService>();

            announcemsntServiceMock.Setup(a => a.GetAnnouncements()).Returns(fakeAgengies);

            controller.AnnouncementService = announcemsntServiceMock.Object;
            // Act
            ViewResult result = controller.About() as ViewResult;

            // Assert
            Assert.AreEqual("Your application description page.", result.ViewBag.Message);
            Assert.AreEqual(typeof(List<Announcement>), result.Model.GetType());
            Assert.AreEqual(2, ((ICollection<Announcement>)result.Model).Count);
        }