mirror of
https://github.com/tribufu/ServerManagers
synced 2026-05-06 15:17:34 +00:00
World Save Back and Restore Changes
1. added the SaveGames folder to the to the backup zip file. 2. now restores the SaveGames folder.
This commit is contained in:
parent
aa5c135be7
commit
a5e749963a
19 changed files with 408 additions and 96 deletions
50
src/ServerManager.Common.UnitTests/ZipUtilsUnitTest.cs
Normal file
50
src/ServerManager.Common.UnitTests/ZipUtilsUnitTest.cs
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
using System;
|
||||
using System.IO;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using ServerManagerTool.Common.Utils;
|
||||
|
||||
namespace ServerManager.Common.Tests
|
||||
{
|
||||
[TestClass]
|
||||
public class ZipUtilsUnitTest
|
||||
{
|
||||
[TestMethod]
|
||||
public void ZipUtils_()
|
||||
{
|
||||
// Arrange
|
||||
var zipFile = FetchZipFile();
|
||||
var destinationPath = Path.Combine(@"D:\_smtest", Path.GetFileNameWithoutExtension(zipFile));
|
||||
var destinationPath1 = Path.Combine(destinationPath, "SavedArks");
|
||||
|
||||
// Act
|
||||
var count = ZipUtils.ExtractFiles(zipFile, destinationPath1, recurseFolders: false);
|
||||
// Assert
|
||||
Assert.AreEqual(3, count);
|
||||
|
||||
// Act
|
||||
var exists = ZipUtils.DoesFolderExist(zipFile, "SaveGames");
|
||||
// Assert
|
||||
Assert.IsTrue(exists);
|
||||
|
||||
// Act
|
||||
count = ZipUtils.ExtractFiles(zipFile, destinationPath, sourceFolder: "SaveGames", recurseFolders: true);
|
||||
// Assert
|
||||
Assert.AreEqual(6, count);
|
||||
|
||||
// Act
|
||||
exists = ZipUtils.DoesFolderExist(zipFile, "AwesomeTeleporters");
|
||||
// Assert
|
||||
Assert.IsTrue(exists);
|
||||
|
||||
// Act
|
||||
count = ZipUtils.ExtractFiles(zipFile, destinationPath, sourceFolder: "AwesomeTeleporters", recurseFolders: true);
|
||||
// Assert
|
||||
Assert.AreEqual(1, count);
|
||||
}
|
||||
|
||||
private string FetchZipFile()
|
||||
{
|
||||
return @"D:\_smtest\new_theisland_20220501_221004.zip";
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue