public void Valid_FullyGenerated_FilesAry() { Directory.CreateDirectory(OutputPath); string targetPath = Path.Combine(OutputPath, nameof(Valid_FullyGenerated_FilesAry) + ".json"); var task = new GenerateManifest() { Id = "TestPlugin", Name = "Test Plugin", Author = "Zingabopp", Version = "1.0.0", GameVersion = "1.14.0", Description = "Description of a test plugin.", DependsOn = MockTaskItem.FromDictString("DependsOn", "BSIPA|^4.3.0", "TestDepend1|^2.0.1", "TestDepend2|^1.0.0"), ConflictsWith = MockTaskItem.FromDictString("ConflictsWith", "TestConflict1|^2.0.1", "TestConflict2|^1.0.0"), Files = new string[] { "Libs/TestLib1.dll", "Libs/TestLib2.dll" }, Donate = "http://donate.com", ProjectHome = "http://project.home", ProjectSource = "http://project.source", PluginHint = "Namespace.Plugin.Type", RequiresBsipa = false, TargetPath = targetPath }; Assert.IsTrue(task.Execute()); BsipaManifest manifest = BsipaManifest.FromJson(File.ReadAllText(targetPath)); TestManifest(task, manifest); Assert.AreEqual(task.Donate, manifest.Donate); Assert.AreEqual(task.ProjectHome, manifest.ProjectHome); Assert.AreEqual(task.ProjectSource, manifest.ProjectSource); Assert.AreEqual(task.PluginHint, manifest.PluginHint); }
public void InvalidPropertiesRequiresBsipa_ThrowsException() { Directory.CreateDirectory(OutputPath); string targetPath = Path.Combine(OutputPath, nameof(InvalidProperties_ThrowsException) + ".json"); MockTaskLogger logger = new MockTaskLogger(nameof(GenerateManifest)); var task = new GenerateManifest() { RequiresBsipa = true, TargetPath = targetPath, Logger = logger, DependsOn = MockTaskItem.FromDictString("DependsOn", "BSIPA|^4.3.0"), }; Assert.IsFalse(task.Execute()); var logEntry = logger.LogEntries.First(); Console.Write(logEntry.Message); var exception = logEntry.Exception as ManifestValidationException; Assert.IsNotNull(exception); var props = exception.InvalidProperties; Assert.IsTrue(props.Any(p => p == nameof(GenerateManifest.Id))); Assert.IsTrue(props.Any(p => p == nameof(GenerateManifest.Name))); Assert.IsTrue(props.Any(p => p == nameof(GenerateManifest.Author))); Assert.IsTrue(props.Any(p => p == nameof(GenerateManifest.Version))); Assert.IsTrue(props.Any(p => p == nameof(GenerateManifest.GameVersion))); Assert.IsTrue(props.Any(p => p == nameof(GenerateManifest.Description))); }
public void Valid_WithBaseManifest_DependsOnSingle() { Directory.CreateDirectory(OutputPath); string basePath = Path.Combine(Data, "manifest.json"); int baseDepends = 2; int baseConflicts = 0; string targetPath = Path.Combine(OutputPath, nameof(Valid_WithBaseManifest_DependsOnSingle) + ".json"); var task = new GenerateManifest() { Id = "TestPlugin", Name = "Test Plugin", Author = "Zingabopp", Version = "1.0.0", GameVersion = "1.14.0", Description = "Description of a test plugin.", DependsOn = MockTaskItem.FromDictString("DependsOn", "BSIPA|^4.3.0", "TestDepend1|^2.0.1", "TestDepend2|^1.0.0"), ConflictsWith = MockTaskItem.FromDictString("ConflictsWith", "TestConflict1|^2.0.1", "TestConflict2|^1.0.0"), RequiresBsipa = true, BaseManifestPath = basePath, TargetPath = targetPath }; Assert.IsTrue(task.Execute()); BsipaManifest manifest = BsipaManifest.FromJson(File.ReadAllText(targetPath)); TestManifest(task, manifest, baseDepends, baseConflicts); }
public void Valid_FullyGenerated_DependsOnArray() { Directory.CreateDirectory(OutputPath); string targetPath = Path.Combine(OutputPath, nameof(Valid_FullyGenerated_DependsOnArray) + ".json"); var task = new GenerateManifest() { Id = "TestPlugin", Name = "Test Plugin", Author = "Zingabopp", Version = "1.0.0", GameVersion = "1.14.0", Description = "Description of a test plugin.", DependsOn = MockTaskItem.FromDictString("DependsOn", "BSIPA|^4.3.0", "TestDepend1|^2.0.1", "TestDepend2|^1.0.0"), RequiresBsipa = true, TargetPath = targetPath }; Assert.IsTrue(task.Execute()); BsipaManifest manifest = BsipaManifest.FromJson(File.ReadAllText(targetPath)); TestManifest(task, manifest); }
public void MergeAllTest() { Directory.CreateDirectory(OutputPath); string basePath = Path.Combine(Data, "overwrite.json"); string targetPath = Path.Combine(OutputPath, nameof(MergeAllTest) + ".json"); Console.WriteLine($"Writing output to '{Path.GetFullPath(targetPath)}'"); var task = new GenerateManifest() { Id = "New-ID", Name = "New-Name", Author = "New-Author", Version = "1.0.0-New", GameVersion = "1.14.0-New", Description = "New-Description", Files = new string[] { "Libs/New-File1.dll", "Libs/New-File2.dll" }, DependsOn = MockTaskItem.FromDictString("DependsOn", "BSIPA|^NewVersion", "New-Depend|^2.0.1", "TestDepend2|^1.0.0"), ConflictsWith = MockTaskItem.FromDictString("ConflictsWith", "BeatSaberPlus|^NewVersion", "New-Conflict|^1.0.0"), LoadBefore = new string[] { "Libs/New-LoadBefore1.dll", "Libs/New-LoadBefore2.dll" }, LoadAfter = new string[] { "Libs/New-LoadAfter1.dll", "Libs/New-LoadAfter2.dll" }, Icon = "New-Icon.png", Donate = "http://New-donate.com", ProjectHome = "http://New-project.home", ProjectSource = "http://New-project.source", Features = "{ \"New-Feature\" : { \"name\" : \"New-feature-name\" } }", Misc = "{ \"Other-Misc\" : { \"name\" : \"New-Misc-name\" } }", PluginHint = "Namespace.Plugin.Type", RequiresBsipa = true, BaseManifestPath = basePath, TargetPath = targetPath }; Assert.IsTrue(task.Execute()); }
public void ConstructItemNameTaskItemSimple() { MockTaskItem taskItem = new MockTaskItem(); BuildItem item = new BuildItem("n", taskItem); Assertion.AssertEquals("n", item.Name); Assertion.AssertEquals("i", item.FinalItemSpec); }