예제 #1
0
        public void TestAutoAddIgnoredFile()
        {
            ContextBase ctx = this.CreateContextAndLoad();

            string path = Path.Combine(this.WcPath, "File.ignored");

            File.CreateText(path).Close();
            ctx.Client.PropSet(new Property("svn:ignore", "File.ignored"),
                               this.WcPath, Recurse.Full);

            int youngest;

            ctx.Client.Status(out youngest, path, Revision.Unspecified,
                              new StatusCallback(this.IgnoredFileCallback), false, true, false, true);
            Assert.AreEqual(StatusKind.Ignored,
                            this.ignoredFileStatus.TextStatus);

            ctx.DTE.Solution.Projects.Item(1
                                           ).ProjectItems.AddFromFile(path);
            ctx.CheckForException();

            // verify that the file is *NOT* added.
            ctx.Client.Status(out youngest, path, Revision.Unspecified,
                              new StatusCallback(this.IgnoredFileCallback), false, true, false, true);
            Assert.AreEqual(StatusKind.Ignored,
                            this.ignoredFileStatus.TextStatus);
        }
예제 #2
0
        public void TestItemAutoAddedTwice()
        {
            ContextBase ctx = this.CreateContextAndLoad();

            string path = Path.Combine(this.WcPath, "File.cs");

            File.CreateText(path).Close();

            SvnItem item = ctx.StatusCache[path];

            ctx.Client.Add(path, Recurse.None);

            // unless the sink refreshes the item, it will be
            // seen as unversioned and it will try to add it.
            ctx.DTE.Solution.Projects.Item(1
                                           ).ProjectItems.AddFromFile(path);

            // verify that no exception was thrown
            ctx.CheckForException();


            // verify that the file is correctly added.
            Assert.AreEqual(StatusKind.Added,
                            ctx.Client.SingleStatus(path).TextStatus);
        }
예제 #3
0
        public void TestRemoveFile()
        {
            ContextBase ctx = this.CreateContextAndLoad();

            ctx.DTE.Solution.Projects.Item(1).
            ProjectItems.Item("Form1.cs").Delete();

            ctx.CheckForException();

            string path = Path.Combine(this.WcPath, "Form1.cs");

            Assert.AreEqual(StatusKind.Deleted,
                            ctx.Client.SingleStatus(path).TextStatus);
        }
예제 #4
0
        public void TestItemAutoAdded()
        {
            ContextBase ctx = this.CreateContextAndLoad();

            string path = Path.Combine(this.WcPath, "File.cs");

            File.CreateText(path).Close();

            ctx.DTE.Solution.Projects.Item(1
                                           ).ProjectItems.AddFromFile(path);
            ctx.CheckForException();

            // verify that the file is correctly added.
            Assert.AreEqual(StatusKind.Added,
                            ctx.Client.SingleStatus(path).TextStatus);
        }
예제 #5
0
        public void TestAttemptRenameFile()
        {
            ContextBase ctx     = this.CreateContextAndLoad();
            MyUIShell   myShell = new MyUIShell();

            ctx.uiShell = myShell;

            ctx.DTE.Solution.Projects.Item(1).
            ProjectItems.Item("Form1.cs").Name = "Form.cs";
            ctx.CheckForException();

            Assert.IsTrue(myShell.MessageBoxShown);
            Assert.IsTrue(File.Exists(
                              Path.Combine(this.WcPath, "Form1.cs")));
            Assert.AreEqual("Form1.cs", ctx.DTE.Solution.Projects.Item(1).
                            ProjectItems.Item("Form1.cs").Name);
        }
예제 #6
0
        public void TestAddFileUri()
        {
            ContextBase ctx = this.CreateContextAndLoad();

            string path = Path.Combine(this.WcPath, "File.cs");

            File.CreateText(path).Close();

            string uri = "file:///" + path.Replace("\\", "/");

            ctx.DTE.Solution.Projects.Item(1
                                           ).ProjectItems.AddFromFile(uri);
            ctx.CheckForException();

            Assert.AreEqual(StatusKind.Added,
                            ctx.Client.SingleStatus(path).TextStatus);
        }
예제 #7
0
        public void TestNonVersionedMiscellaneousFileAdded()
        {
            ContextBase ctx = this.CreateContextAndLoad();
            string      dir = Path.Combine(this.WcPath, "Unversioned");

            Directory.CreateDirectory(dir);
            string file = Path.Combine(dir, "unversioned.txt");

            File.CreateText(file).Close();

            ctx.DTE.ExecuteCommand("File.OpenFile", file);

            ctx.CheckForException();

            Assert.AreEqual(Status.None,
                            ctx.Client.SingleStatus(file));
        }