public void Cook_CopyExistingFiles() { UpdateRecipeFile file1 = new UpdateRecipeFile("test1.txt", "123", 100, FileUpdateAction.Copy, null); UpdateRecipeFile file2 = new UpdateRecipeFile("test2.txt", "123", 100, FileUpdateAction.Download, "test2.txt.deploy"); UpdateRecipe updateRecipe = new UpdateRecipe("2.0.0", "1.0.0", new UpdateRecipeFile[] { file1, file2 }); updaterChef.Cook(updateRecipe); localStructureManager.AssertWasCalled(x => x.CopyFile("1.0.0", "2.0.0", "test1.txt")); }
public void Cook_SavesNewFiles() { byte[] data = new byte[]{1,2,3,4,5}; updateServer.Stub(x => x.DownloadFile("2.0.0", "test2.txt.deploy")).Return(DataCompressor.Compress(data)); UpdateRecipeFile file1 = new UpdateRecipeFile("test1.txt", "123", 100, FileUpdateAction.Copy, null); UpdateRecipeFile file2 = new UpdateRecipeFile("test2.txt", "123", 100, FileUpdateAction.Download, "test2.txt.deploy"); UpdateRecipe updateRecipe = new UpdateRecipe("2.0.0", "1.0.0", new UpdateRecipeFile[] { file1, file2 }); updaterChef.Cook(updateRecipe); localStructureManager.AssertWasCalled(x => x.SaveFile("2.0.0", "test2.txt", data)); }
public void Cook_ApplyDeltaInModifiedFiles() { byte[] data = new byte[] { 1, 2, 3, 4, 5 }; updateServer.Stub(x => x.DownloadFile("2.0.0", "test2.txt.deploy")).Return(data); UpdateRecipeFile file1 = new UpdateRecipeFile("test1.txt", "123", 100, FileUpdateAction.Copy, null); UpdateRecipeFile file2 = new UpdateRecipeFile("test2.txt", "123", 100, FileUpdateAction.DownloadDelta, "test2.txt.deploy"); UpdateRecipe updateRecipe = new UpdateRecipe("2.0.0", "1.0.0", new UpdateRecipeFile[] { file1, file2 }); updaterChef.Cook(updateRecipe); localStructureManager.AssertWasCalled(x => x.ApplyDelta("1.0.0", "2.0.0", "test2.txt", data)); }