Пример #1
0
        public void allpages()
        {
            // Arrange


            // Act
            List <Page> actualList = Repository.AllPages().ToList();

            // Assert
            Assert.That(actualList.Count, Is.EqualTo(5));
            Assert.That(actualList[0], Is.Not.Null);
            Assert.That(actualList[1], Is.Not.Null);
            Assert.That(actualList[2], Is.Not.Null);
            Assert.That(actualList[3], Is.Not.Null);
            Assert.That(actualList[4], Is.Not.Null);
        }
Пример #2
0
        public void post_should_add_page()
        {
            // Arrange
            PageViewModel page = new PageViewModel()
            {
                Title     = "Hello",
                CreatedBy = "admin",
                CreatedOn = DateTime.UtcNow,
                Content   = "some content",
                RawTags   = "tag1,tag2"
            };

            WebApiClient apiclient = new WebApiClient();

            apiclient.Login();

            // Act
            WebApiResponse response = apiclient.Post <PageViewModel>("Pages", page);

            // Assert
            IPageRepository    repository = GetRepository();
            IEnumerable <Page> pages      = repository.AllPages();

            Assert.That(pages.Count(), Is.EqualTo(1), response);
        }
Пример #3
0
        public void put_should_update_page()
        {
            // Arrange
            PageContent   pageContent = AddPage("test", "this is page 1");
            PageViewModel viewModel   = new PageViewModel(pageContent.Page);

            viewModel.Title = "New title";

            WebApiClient apiclient = new WebApiClient();

            // Act
            WebApiResponse response = apiclient.Put <PageViewModel>("Pages/Put", viewModel);

            // Assert
            IPageRepository repository = GetRepository();
            Page            page       = repository.AllPages().FirstOrDefault();

            Assert.That(page.Title, Is.EqualTo("New title"), response);
        }