AppUpdater.Tests.DefaultLocalStructureManagerTests.ApplyDelta_SavesThePatchedFile C# (CSharp) Method

ApplyDelta_SavesThePatchedFile() private method

private ApplyDelta_SavesThePatchedFile ( ) : void
return void
        public void ApplyDelta_SavesThePatchedFile()
        {
            Directory.CreateDirectory(Path.Combine(baseDir, "1.2.3"));
            Directory.CreateDirectory(Path.Combine(baseDir, "2.0.0"));
            byte[] originalData = new byte[] { 4, 5, 6, 5, 4 };
            byte[] newData = new byte[] { 4, 5, 6, 5, 4 };
            string originalFile = Path.Combine(baseDir, "1.2.3\\test1.dat");
            string newFile = Path.GetTempFileName();
            string deltaFile = Path.GetTempFileName();
            string patchedFile = Path.GetTempFileName();
            File.WriteAllBytes(originalFile, originalData);
            File.WriteAllBytes(newFile, newData);
            DeltaAPI.CreateDelta(originalFile, newFile, deltaFile, true);
            byte[] deltaData = File.ReadAllBytes(deltaFile);

            structureManager.ApplyDelta("1.2.3", "2.0.0", "test1.dat", deltaData);

            Assert.That(File.Exists(Path.Combine(baseDir, "2.0.0\\test1.dat")), Is.True);
            byte[] patchedData = File.ReadAllBytes(Path.Combine(baseDir, "2.0.0\\test1.dat"));
            Assert.That(patchedData, Is.EqualTo(newData));
        }