public void Test6() { var fs = new MockFileSystem(new Dictionary <string, MockFileData>()); var mainFile = new MainModinfoFile(ModinfoDataUtils.CreateModifnoFile(fs, "mods/A")); Assert.Throws <ModinfoException>(() => new ModinfoFinderCollection( fs.DirectoryInfo.FromDirectoryName("mods/A"), new[] { mainFile })); }
public void TestMainFile() { var fileInfo = ModinfoDataUtils.CreateModifnoFile(new MockFileSystem(), "mods/A"); IModinfoFile modinfoFile = new MainModinfoFile(fileInfo); Assert.Equal(ModinfoFileKind.MainFile, modinfoFile.FileKind); Assert.Null(Record.Exception(modinfoFile.ValidateFile)); Assert.Null(Record.Exception(modinfoFile.GetModinfo)); Assert.Null(Record.ExceptionAsync(modinfoFile.GetModinfoAsync).Result); }
public void Test1() { var fs = new MockFileSystem(new Dictionary <string, MockFileData>()); var mainFile = new MainModinfoFile(ModinfoDataUtils.CreateModifnoFile(fs, "mods/A")); var collection = new ModinfoFinderCollection(fs.DirectoryInfo.FromDirectoryName("mods/A"), mainFile); Assert.Single(collection); Assert.NotNull(collection.MainModinfo); Assert.Empty(collection.Variants); }
public void Test3() { var fs = new MockFileSystem(new Dictionary <string, MockFileData>()); var variant = new ModinfoVariantFile(ModinfoDataUtils.CreateVariantMainFile(fs, "mods/A")); var mainFile = new MainModinfoFile(ModinfoDataUtils.CreateModifnoFile(fs, "mods/A")); var collection = new ModinfoFinderCollection( fs.DirectoryInfo.FromDirectoryName("mods/A"), mainFile, new[] { variant }); Assert.Equal(2, collection.Count()); Assert.Single(collection.Variants); Assert.NotNull(collection.MainModinfo); }
public void TestVariantFile2() { var fs = new MockFileSystem(); var mainFileInfo = ModinfoDataUtils.CreateModifnoFile(fs, "mods/A"); IModinfoFile mainFile = new MainModinfoFile(mainFileInfo); var variantFileInfo = ModinfoDataUtils.CreateVariantFile(fs, "mods/A"); IModinfoFile variantFile = new ModinfoVariantFile(variantFileInfo, mainFile); Assert.Equal(ModinfoFileKind.VariantFile, variantFile.FileKind); Assert.Null(Record.Exception(variantFile.ValidateFile)); Assert.Null(Record.Exception(variantFile.GetModinfo)); Assert.Null(Record.ExceptionAsync(variantFile.GetModinfoAsync).Result); var data = variantFile.GetModinfo(); Assert.Equal(new Version(1, 1, 1, "BETA"), data.Version); Assert.Single(data.Custom); Assert.Single(data.Languages); }