Esempio n. 1
0
        public void ShouldDeleteClientSpecAndWorkingDirectoryOnPurge()
        {
            // Setup
            P4 p4 = new P4();

            p4.Client = "myClient";

            ProcessInfo processInfo = new ProcessInfo("deleteclient");

            processInfoCreatorMock.Setup(creator => creator.CreateProcessInfo(p4, "client -d myClient")).Returns(processInfo).Verifiable();
            processExecutorMock.Setup(executor => executor.Execute(processInfo)).Returns(new ProcessResult("", "", 0, false)).Verifiable();

            Assert.IsTrue(Directory.Exists(tempDirPath));

            // Execute
            p4Purger.Purge(p4, tempDirPath);

            // Verify
            Assert.IsFalse(Directory.Exists(tempDirPath));
            VerifyAll();
        }
        public void ShouldDeleteClientSpecAndWorkingDirectoryOnPurge()
        {
            // Setup
            DynamicMock p4Mock = new DynamicMock(typeof(P4));
            P4          p4     = (P4)p4Mock.MockInstance;

            p4.Client = "myClient";

            ProcessInfo processInfo = new ProcessInfo("deleteclient");

            processInfoCreatorMock.ExpectAndReturn("CreateProcessInfo", processInfo, p4, "client -d myClient");
            processExecutorMock.ExpectAndReturn("Execute", new ProcessResult("", "", 0, false), processInfo);

            Assert.IsTrue(Directory.Exists(tempDirPath));

            // Execute
            p4Purger.Purge(p4, tempDirPath);

            // Verify
            Assert.IsFalse(Directory.Exists(tempDirPath));
            VerifyAll();
        }