public void WhenArchiveIsAlreadyBuilt_AndArchiveIsInOutputDirectory_ArchiveIsNotCopied() { AddSimpleBundleAndBuild(out ArchiveAndCompressBundles.TaskInput input, out string bundleOutDir1); ScopeCapturer log2 = new ScopeCapturer(); input.GetOutputFilePathForIdentifier = (x) => Path.Combine(bundleOutDir1, x); input.Log = log2; ArchiveAndCompressBundles.Run(input, out ArchiveAndCompressBundles.TaskOutput output2); Assert.AreEqual(1, input.OutCachedBundles.Count); Assert.AreEqual("mybundle", input.OutCachedBundles[0]); Assert.IsFalse(log2.ContainsScopeWithSubstring("Copying From Cache")); }
public void WhenArchiveIsAlreadyBuilt_AndArchiveIsInOutputDirectoryButTimestampMismatch_ArchiveIsCopied() { AddSimpleBundleAndBuild(out ArchiveAndCompressBundles.TaskInput input, out string bundleOutDir1); // Change the creation timestamp on the bundles string bundlePath = Path.Combine(bundleOutDir1, "mybundle"); File.SetLastWriteTime(bundlePath, new DateTime(2019, 1, 1)); ScopeCapturer log2 = new ScopeCapturer(); input.GetOutputFilePathForIdentifier = (x) => Path.Combine(bundleOutDir1, x); input.Log = log2; ArchiveAndCompressBundles.Run(input, out ArchiveAndCompressBundles.TaskOutput output2); Assert.AreEqual(1, input.OutCachedBundles.Count); Assert.AreEqual("mybundle", input.OutCachedBundles[0]); Assert.IsTrue(log2.ContainsScopeWithSubstring("Copying From Cache")); }
private void AddSimpleBundleAndBuild(out ArchiveAndCompressBundles.TaskInput input, out string bundleBuildDir) { ScopeCapturer log1 = new ScopeCapturer(); string bDir = Path.Combine(m_TestTempDir, "bundleoutdir1"); Directory.CreateDirectory(bDir); input = GetDefaultInput(); BuildCache cache = new BuildCache(); input.BuildCache = cache; input.Log = log1; AddSimpleBundle(input, "mybundle", "internalName"); input.GetOutputFilePathForIdentifier = (x) => Path.Combine(bDir, x); ArchiveAndCompressBundles.Run(input, out ArchiveAndCompressBundles.TaskOutput output); Assert.AreEqual(0, input.OutCachedBundles.Count); Assert.IsTrue(log1.ContainsScopeWithSubstring("Copying From Cache")); cache.SyncPendingSaves(); bundleBuildDir = bDir; }