コード例 #1
0
ファイル: P4MapApiTest.cs プロジェクト: startere/p4api.net
        public void InsertTest1()
        {
            bool unicode = false;

            for (int i = 0; i < 2; i++)
            {
                using (P4Server pserver = new P4Server(unicode))
                {
                    using (P4MapApi target = new P4MapApi(pserver))
                    {
                        string        lr1   = "Both 1";
                        P4MapApi.Type type1 = P4MapApi.Type.Include;
                        target.Insert(lr1, type1);

                        string        lr2   = "Both 2";
                        P4MapApi.Type type2 = P4MapApi.Type.Include;
                        target.Insert(lr2, type2);

                        int tCount = target.Count;
                        Assert.AreEqual(2, tCount);

                        // no errors so passed
                    }
                }
            }
        }
コード例 #2
0
ファイル: P4MapApiTest.cs プロジェクト: startere/p4api.net
        public void TranslateTest()
        {
            bool unicode = false;

            for (int i = 0; i < 2; i++)
            {
                using (P4MapApi target = new P4MapApi(unicode))
                {
                    String        left1  = "//depot/...";
                    String        right1 = "//ws/...";
                    P4MapApi.Type type1  = P4MapApi.Type.Include;
                    target.Insert(left1, right1, type1);

                    int tCount = target.Count;
                    Assert.AreEqual(1, tCount);

                    String actual = target.Translate("//ws/foo.txt", P4MapApi.Direction.RightLeft);
                    Assert.AreEqual(actual, "//depot/foo.txt");

                    actual = target.Translate("//depot/foo.txt", P4MapApi.Direction.LeftRight);
                    Assert.AreEqual(actual, "//ws/foo.txt");

                    actual = target.Translate("//usr/bar.txt", P4MapApi.Direction.LeftRight);
                    Assert.AreEqual(actual, null);

                    unicode = !unicode;
                }
            }
        }
コード例 #3
0
ファイル: P4MapApiTest.cs プロジェクト: startere/p4api.net
        public void GetLeftTest()
        {
            bool unicode = false;

            for (int i = 0; i < 2; i++)
            {
                using (P4MapApi target = new P4MapApi(unicode))
                {
                    string        left1  = "//depot/main/...";
                    string        right1 = "//XP1_usr/depot/main/...";
                    P4MapApi.Type type1  = P4MapApi.Type.Include;
                    target.Insert(left1, right1, type1);

                    string        left2  = "//depot/main/www/...";
                    string        right2 = "//XP1_usr/depot/main/www/...";
                    P4MapApi.Type type2  = P4MapApi.Type.Exclude;
                    target.Insert(left2, right2, type2);


                    string        left3  = "//depot/dev/script/...";
                    string        right3 = "//XP1_usr/depot/dev/script/...";
                    P4MapApi.Type type3  = P4MapApi.Type.Include;
                    target.Insert(left3, right3, type3);


                    string        left4  = "//depot/main/www/...";
                    string        right4 = "//XP1_usr/depot/live/www/*.html";
                    P4MapApi.Type type4  = P4MapApi.Type.Include;
                    target.Insert(left4, right4, type4);

                    int tCount = target.Count;
                    Assert.AreEqual(4, tCount);

                    String actual = target.GetLeft(1);
                    Assert.AreEqual(left2, actual);

                    actual = target.GetLeft(0);
                    Assert.AreEqual(left1, actual);

                    unicode = !unicode;
                }
            }
        }
コード例 #4
0
ファイル: P4MapApiTest.cs プロジェクト: startere/p4api.net
        public void JoinTest()
        {
            bool unicode = false;

            for (int i = 0; i < 2; i++)
            {
                using (P4MapApi target1 = new P4MapApi(unicode))
                {
                    String        left1  = "//depot/...";
                    String        right1 = "//ws/...";
                    P4MapApi.Type type1  = P4MapApi.Type.Include;
                    target1.Insert(left1, right1, type1);

                    int tCount1 = target1.Count;
                    Assert.AreEqual(1, tCount1);

                    using (P4MapApi target2 = new P4MapApi(unicode))
                    {
                        String        left2  = "//ws/...";
                        String        right2 = "//ace/...";
                        P4MapApi.Type type2  = P4MapApi.Type.Include;
                        target2.Insert(left2, right2, type2);

                        int tCount2 = target2.Count;
                        Assert.AreEqual(1, tCount2);

                        using (P4MapApi actual = P4MapApi.Join(target1, P4MapApi.Direction.LeftRight, target2, P4MapApi.Direction.LeftRight))
                        {
                            int tCount3 = actual.Count;
                            Assert.AreEqual(1, tCount3);

                            string translated = actual.Translate("//depot/foo.txt", P4MapApi.Direction.LeftRight);
                            Assert.AreEqual(translated, "//ace/foo.txt");

                            unicode = !unicode;
                        }
                    }
                }
            }
        }