Ejemplo n.º 1
0
        public void AllTagsAsJson_Should_Return_Model_And_Tags()
        {
            // Arrange
            Page page1 = AddDummyPage1();

            page1.Tags = "a-tag,b-tag";

            Page page2 = AddDummyPage2();

            page2.Tags = "z-tag,a-tag";

            // Act
            ActionResult result = _pagesController.AllTagsAsJson();

            // Assert
            Assert.That(result, Is.TypeOf <JsonResult>(), "JsonResult");

            JsonResult jsonResult = result as JsonResult;

            Assert.NotNull(jsonResult, "Null jsonResult");

            var xxx = jsonResult.Data.GetType();

            Assert.That(jsonResult.JsonRequestBehavior, Is.EqualTo(JsonRequestBehavior.AllowGet));
            Assert.That(jsonResult.Data, Is.AssignableTo <IEnumerable <string> >());
            _pageServiceMock.Verify(x => x.AllTags());
        }