コード例 #1
0
        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 }));
        }
コード例 #2
0
        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);
        }
コード例 #3
0
        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);
        }
コード例 #4
0
        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);
        }
コード例 #5
0
        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);
        }