Esempio n. 1
0
        public void FetchTest()
        {
            bool unicode = false;

            string server    = "localhost:6666";
            string user      = "******";
            string pass      = string.Empty;
            string ws_client = "admin_space";

            for (int i = 0; i < 2; i++)  // run once for ascii, once for unicode
            {
                Process p4d = Utilities.DeployP4TestServer(TestDir, unicode);
                try
                {
                    using (P4Server target = new P4Server(server, user, pass, ws_client))
                    {
                        P4Specification actual = P4Specification.Fetch("client", target, "admin_space");
                        Assert.IsNotNull(actual);
                    }
                }
                catch (Exception ex)
                {
                    Assert.Fail("Exception Thrown: {0} : {1}", ex.ToString(), ex.Message);
                }
                finally
                {
                    Utilities.RemoveTestServer(p4d, TestDir);
                }
                unicode = !unicode;
            }
        }
Esempio n. 2
0
        public void SaveTest()
        {
            bool unicode = false;

            string server    = "localhost:6666";
            string user      = "******";
            string pass      = string.Empty;
            string ws_client = "admin_space";

            for (int i = 0; i < 2; i++) // run once for ascii, once for unicode
            {
                Process p4d = Utilities.DeployP4TestServer(TestDir, unicode);
                try
                {
                    using (P4Server target = new P4Server(server, user, pass, ws_client))
                    {
                        P4Specification actual = new P4Specification(target, "admin_space2", "client");
                        actual.Fetch();
                        Assert.IsNotNull(actual);
                        Assert.AreEqual("admin_space2", actual["Client"]);

                        actual.Name      = "admin_space3";
                        actual["Client"] = actual.Name;

                        actual.Save();

                        Assert.AreEqual("Client admin_space3 saved.", actual.LastCommandResults.InfoOutput[0].Info);
                    }
                }
                catch (Exception ex)
                {
                    Assert.Fail("Exception Thrown: {0} : {1}", ex.ToString(), ex.Message);
                }
                finally
                {
                    Utilities.RemoveTestServer(p4d, TestDir);
                }
                unicode = !unicode;
            }
        }