예제 #1
0
        public void DeleteFile()
        {
            using (var database = TestHelper.GetDatabase())
            {
                var user = TestHelper.AddUser(database, "Administrator", "Password!", "administrator");
                TestHelper.AddDefaultSettings(database);
                var john = TestHelper.AddUser(database, "John Doe", "*****@*****.**", "Password!");
                var file = TestHelper.AddFile(database, john, "File.png", "image/png", new byte[0]);
                database.SaveChanges();

                var client = new ScribeClient(TestSite, TestService);
                client.LogIn(new Credentials {
                    UserName = "******", Password = "******"
                });
                client.DeleteFile(file.Id);

                TestHelper.ExpectedException <Exception>(() =>
                {
                    var result = client.GetPage(file.Id);
                    Assert.AreEqual("Hello Page", result.Title);
                }, "Bad Request");

                Assert.AreEqual(0, database.PageVersions.Count());
            }
        }
예제 #2
0
        public void DeletePage()
        {
            using (var database = TestHelper.GetDatabase())
            {
                var user = TestHelper.AddUser(database, "Administrator", "Password!", "administrator");
                TestHelper.AddDefaultSettings(database);
                var john = TestHelper.AddUser(database, "John Doe", "*****@*****.**", "Password!");
                var page = TestHelper.AddPage(database, "Hello Page", "Hello World", john, ApprovalStatus.None, false, "myTag");
                database.SaveChanges();

                var client = new ScribeClient(TestSite, TestService);
                Assert.IsFalse(client.IsAuthenticated);

                client.LogIn(new Credentials {
                    UserName = "******", Password = "******"
                });
                Assert.IsTrue(client.IsAuthenticated);

                client.DeletePage(page.Id);

                TestHelper.ExpectedException <Exception>(() =>
                {
                    var result = client.GetPage(page.Id);
                    Assert.AreEqual("Hello Page", result.Title);
                }, "Bad Request");

                Assert.AreEqual(0, database.PageVersions.Count());
            }
        }
예제 #3
0
        public void GetPage()
        {
            using (var database = TestHelper.GetDatabase())
            {
                var user = TestHelper.AddUser(database, "Administrator", "Password!", "administrator");
                TestHelper.AddDefaultSettings(database);
                var john = TestHelper.AddUser(database, "John Doe", "*****@*****.**", "Password!");
                var page = TestHelper.AddPage(database, "Hello Page", "Hello World", john, ApprovalStatus.None, false, "myTag");
                database.SaveChanges();

                var client = new ScribeClient(TestSite, TestService);
                client.LogIn(new Credentials {
                    UserName = "******", Password = "******"
                });
                var result = client.GetPage(page.Id);
                Assert.AreEqual("Hello Page", result.Title);
            }
        }