public void Generate_SqaleFileNotSpecified_TemplateFileCreated() { // Arrange string outputDir = TestUtils.CreateTestDirectory(this.TestContext, ".out"); TestLogger logger = new TestLogger(); RemoteRepoBuilder remoteRepoBuilder = new RemoteRepoBuilder(this.TestContext); CreatePackageInFakeRemoteRepo(remoteRepoBuilder, "dummy.id", "1.1"); NuGetPackageHandler nuGetHandler = new NuGetPackageHandler(remoteRepoBuilder.FakeRemoteRepo, GetLocalNuGetDownloadDir(), logger); string expectedTemplateSqaleFilePath = Path.Combine(outputDir, "dummy.id.1.1.sqale.template.xml"); AnalyzerPluginGenerator apg = new AnalyzerPluginGenerator(nuGetHandler, logger); ProcessedArgs args = CreateArgs("dummy.id", "1.1", "cs", null, false, outputDir); // Act bool result = apg.Generate(args); // Assert Assert.IsTrue(result, "Expecting generation to have succeeded"); Assert.IsTrue(File.Exists(expectedTemplateSqaleFilePath), "Expecting a template sqale file to have been created"); this.TestContext.AddResultFile(expectedTemplateSqaleFilePath); logger.AssertSingleInfoMessageExists(expectedTemplateSqaleFilePath); // should be a message about the generated file }
private void AssertSqaleFileExistsForPackage(TestLogger logger, string outputDir, IPackage package) { string expectedTemplateSqaleFilePath = GetExpectedTemplateSqaleFilePath(outputDir, package); Assert.IsTrue(File.Exists(expectedTemplateSqaleFilePath), "Expecting a template sqale file to have been created"); this.TestContext.AddResultFile(expectedTemplateSqaleFilePath); logger.AssertSingleInfoMessageExists(expectedTemplateSqaleFilePath); // should be a message about the generated file }