Exemplo n.º 1
0
        public StartPageControllerTest()
        {
            // declarations
            _repository = new Mock <IProcessedContentRepository>();

            // data
            var alerts = new List <Alert> {
                new Alert("title", "subHeading", "body", "severity", new DateTime(0001, 1, 1, 0, 0, 0, DateTimeKind.Utc),
                          new DateTime(9999, 9, 9, 0, 0, 0, DateTimeKind.Utc), string.Empty, false)
            };
            // data
            var inlineAlerts = new List <Alert> {
                new Alert("title", "subHeading", "body", "severity", new DateTime(0001, 1, 1, 0, 0, 0, DateTimeKind.Utc),
                          new DateTime(9999, 9, 9, 0, 0, 0, DateTimeKind.Utc), string.Empty, false)
            };

            var startPage = new ProcessedStartPage(
                "start-page",
                "Start Page",
                "this is a teaser",
                "This is a summary",
                "<p>An upper body</p>\n",
                "Start now",
                "http://start.com",
                "<p>Lower body</p>\n",
                new List <Crumb>
            {
                new Crumb("title", "slug", "type")
            },
                "image.jpg",
                "icon",
                alerts
                );

            // setup mocks
            _repository.Setup(o => o.Get <StartPage>("start-page", null)).ReturnsAsync(new HttpResponse(200, startPage, string.Empty));
            _repository.Setup(o => o.Get <StartPage>("doesnt-exist", null)).ReturnsAsync(new HttpResponse(404, null, "No start-page found for 'doesnt-exist'"));

            // objects
            _controller = new StartPageController(_repository.Object);
        }
Exemplo n.º 2
0
 public when_index()
 {
     _controller = new StartPageController();
 }