AddSubforum() public method

public AddSubforum ( string adminUsername, string adminPassword, string subforumName ) : System.Result
adminUsername string
adminPassword string
subforumName string
return System.Result
Beispiel #1
0
        public void AddSubforumPersistencyTest()
        {
            string newForumName = "Persistency Test Forum" + DateTime.Now;
            try
            {
                IForumService sc = new ServerNetworkAdaptor();
                sc.Login("admin", "admin");

                Assert.AreEqual(Result.OK, sc.AddSubforum("admin", "admin", newForumName));
            }
            catch (Exception e)
            {
                Console.WriteLine("Got exception while running test: " + e.Message);
                Console.WriteLine(e.InnerException.Message);
                Assert.Fail();
            }

            //ReloadServer();

            string[] subforums;

            try
            {
                IForumService sc = new ServerNetworkAdaptor();
                subforums = sc.GetSubforumsList();
                Assert.True(subforums.Contains<string>(newForumName), "The subforum was not found after reloading DB!");

                Assert.AreEqual(Result.OK, sc.RemoveSubforum("admin", "admin", newForumName), "Could not remove the subforum");

                subforums = sc.GetSubforumsList();
                Assert.False(subforums.Contains<string>(newForumName), "The sub forum was not removed from the DB");
            }
            catch (Exception e)
            {
                Console.WriteLine("Got exception while running test: " + e.Message);
                Console.WriteLine(e.InnerException.Message);
                Assert.Fail();
            }

            //ReloadServer();

            try
            {
                IForumService sc = new ServerNetworkAdaptor();
                subforums = sc.GetSubforumsList();
                Assert.False(subforums.Contains<string>(newForumName), "The subforum exists in DB after reload!!");
            }
            catch (Exception e)
            {
                Console.WriteLine("Got exception while running test: " + e.Message);
                Console.WriteLine(e.InnerException.Message);
                Assert.Fail();
            }
        }
Beispiel #2
0
 public void AddSubforum()
 {
     ServerNetworkAdaptor target = new ServerNetworkAdaptor(); // TODO: Initialize to an appropriate value
     string adminUsername = "******"; // TODO: Initialize to an appropriate value
     string adminPassword = "******"; // TODO: Initialize to an appropriate value
     string subforumName = "aaaaa"; // TODO: Initialize to an appropriate value
     Result expected = new Result(); // TODO: Initialize to an appropriate value
     Result actual;
     actual = target.AddSubforum(adminUsername, adminPassword, subforumName);
     Assert.AreEqual(expected, actual);
 }