public void PageControllerPost()
        {
            var result = _ctrl.Post(new PageDetail {
                Id = Guid.NewGuid()
            });

            Assert.AreEqual(HttpStatusCode.Created, result.StatusCode);

            var json = result.Content.ReadAsStringAsync().Result;
            var item = JsonConvert.DeserializeObject <PageDetail>(json);

            Assert.IsNotNull(item);
            Assert.IsTrue(item.Id != Guid.Empty && item.Id != null);
        }
Пример #2
0
        public void post_should_add_page()
        {
            // Arrange
            PageViewModel model = new PageViewModel();

            model.Title   = "Hello world";
            model.RawTags = "tag1, tag2";
            model.Content = "Some content";

            // Act
            _pagesController.Post(model);

            // Assert
            Assert.That(_pageService.AllPages().Count(), Is.EqualTo(1));
        }
Пример #3
0
        public void PagesController_Post_Success()
        {
            //arrange
            var form = new DictaatPageForm()
            {
                SubMenu = "a",
                Page    = new DictaatPage()
                {
                    Name   = "b",
                    Source = "c"
                }
            };

            //act
            _controller.Post("d", form);

            //assert
            _pageRepoMock.Verify(p =>
                                 p.CreateDictaatPage(
                                     It.Is <string>(s => s == "d"),
                                     It.IsAny <DictaatPage>()
                                     ), Times.Once());
        }