Esempio n. 1
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
            IRepository        repository = GetRepository();
            IEnumerable <Page> pages      = repository.AllPages();

            Assert.That(pages.Count(), Is.EqualTo(1), response);
        }
Esempio n. 2
0
        public void Authenticate_Should_Return_False_For_Unknown_User()
        {
            // Arrange
            UserController.UserInfo info = new UserController.UserInfo()
            {
                Email    = "badlogin@localhost",
                Password = ADMIN_PASSWORD
            };

            WebApiClient apiclient = new WebApiClient();

            apiclient.Login();

            // Act
            WebApiResponse response = apiclient.Post <UserController.UserInfo>("Authenticate", info);

            // Assert
            Assert.That(response.Content, Is.EqualTo("false"), response);
        }