public void DefaultConstructorSetsFileSystemAndLogger() { var task = new AntsPerformanceProfilerTask(); Assert.IsInstanceOf <SystemIoFileSystem>(task.FileSystem); Assert.IsInstanceOf <DefaultLogger>(task.Logger); }
public void XmlArgsFilesExcludesWorkingDirectoryWhenRooted() { var appName = "testApp.exe"; var result = GenerateResultMock(); var executablePath = Path.Combine(defaultWorkingDir, "Profile"); var executor = GenerateExecutorMock( executablePath, this.defaultExecutableArgs + " /e:" + Path.Combine(defaultWorkingDir, appName) + " /argfile:c:\\args.xml", defaultWorkingDir, 600000); var fileSystemMock = this.InitialiseFileSystemMock(executablePath); var logger = mocks.Create <ILogger>().Object; var task = new AntsPerformanceProfilerTask(executor, fileSystemMock, logger) { PublishFiles = false }; task.Application = appName; task.XmlArgsFile = "c:\\args.xml"; Mock.Get(result).SetupProperty(_result => _result.Status); result.Status = IntegrationStatus.Unknown; task.Run(result); mocks.Verify(); }
public void RunsWithBaseDirectoryForAppProfile() { var baseDir = "aDirSomewhere"; var appName = "testApp.exe"; var result = GenerateResultMock(); var executablePath = Path.Combine(baseDir, "Profile"); var executor = GenerateExecutorMock( executablePath, "/wd:" + baseDir + " /out:" + Path.Combine(baseDir, "AntsPerformanceAnalysis.txt") + " /t:120 /ml /f /is:on /in:on /comp:on /simp:on /notriv:on /e:" + Path.Combine(baseDir, appName), baseDir, 600000); var fileSystemMock = this.InitialiseFileSystemMock(executablePath); var logger = mocks.Create <ILogger>().Object; var task = new AntsPerformanceProfilerTask(executor, fileSystemMock, logger) { PublishFiles = false }; task.Application = appName; task.BaseDirectory = baseDir; Mock.Get(result).SetupProperty(_result => _result.Status); result.Status = IntegrationStatus.Unknown; task.Run(result); mocks.Verify(); }
public void XmlArgsFilesIsQuotedWhenContainingSpaces() { var appName = "testApp.exe"; var result = GenerateResultMock(); var executablePath = Path.Combine(defaultWorkingDir, "Profile"); var executor = GenerateExecutorMock( executablePath, this.defaultExecutableArgs + " /e:" + Path.Combine(defaultWorkingDir, appName) + " /argfile:\"" + Path.Combine(defaultWorkingDir, "args config.xml") + "\"", defaultWorkingDir, 600000); var fileSystemMock = this.InitialiseFileSystemMock(executablePath); var logger = mocks.DynamicMock <ILogger>(); var task = new AntsPerformanceProfilerTask(executor, fileSystemMock, logger) { PublishFiles = false }; task.Application = appName; task.XmlArgsFile = "args config.xml"; Expect.Call(result.Status).PropertyBehavior(); mocks.ReplayAll(); result.Status = IntegrationStatus.Unknown; task.Run(result); mocks.VerifyAll(); }
public void RunsWithDefaultParametersForComPlusProfile() { var appName = "ComPlusService"; var result = GenerateResultMock(); var executablePath = Path.Combine(defaultWorkingDir, "Profile"); var executor = GenerateExecutorMock( executablePath, this.defaultExecutableArgs + " /complus:" + appName, defaultWorkingDir, 600000); var fileSystemMock = this.InitialiseFileSystemMock(executablePath); var logger = mocks.DynamicMock <ILogger>(); var task = new AntsPerformanceProfilerTask(executor, fileSystemMock, logger) { PublishFiles = false }; task.ComPlus = appName; Expect.Call(result.Status).PropertyBehavior(); mocks.ReplayAll(); result.Status = IntegrationStatus.Unknown; task.Run(result); mocks.VerifyAll(); }
public void ValidateDoesNotAllowaNegativeProfilerTimeout() { var trace = new ConfigurationTrace(null, null); var errorProcesser = this.mocks.Create <IConfigurationErrorProcesser>(MockBehavior.Strict).Object; Mock.Get(errorProcesser).Setup(_errorProcesser => _errorProcesser.ProcessError("profilerTimeout cannot be negative")).Verifiable(); var task = new AntsPerformanceProfilerTask(); task.ProfilerTimeOut = -1; task.Validate(null, trace, errorProcesser); this.mocks.VerifyAll(); }
public void ValidateDoesNotAllowBothQuietAndVerbose() { var trace = new ConfigurationTrace(null, null); var errorProcesser = this.mocks.Create <IConfigurationErrorProcesser>(MockBehavior.Strict).Object; Mock.Get(errorProcesser).Setup(_errorProcesser => _errorProcesser.ProcessError("Cannot have both verbose and quiet set")).Verifiable(); var task = new AntsPerformanceProfilerTask(); task.Quiet = true; task.Verbose = true; task.Validate(null, trace, errorProcesser); this.mocks.VerifyAll(); }
public void ValidateDoesNotAllowaNegativeProfilerTimeout() { var trace = new ConfigurationTrace(null, null); var errorProcesser = this.mocks.StrictMock <IConfigurationErrorProcesser>(); Expect.Call(() => errorProcesser.ProcessError("profilerTimeout cannot be negative")); var task = new AntsPerformanceProfilerTask(); task.ProfilerTimeOut = -1; this.mocks.ReplayAll(); task.Validate(null, trace, errorProcesser); this.mocks.VerifyAll(); }
public void ValidateDoesNotAllowBothQuietAndVerbose() { var trace = new ConfigurationTrace(null, null); var errorProcesser = this.mocks.StrictMock <IConfigurationErrorProcesser>(); Expect.Call(() => errorProcesser.ProcessError("Cannot have both verbose and quiet set")); var task = new AntsPerformanceProfilerTask(); task.Quiet = true; task.Verbose = true; this.mocks.ReplayAll(); task.Validate(null, trace, errorProcesser); this.mocks.VerifyAll(); }
public void RunsWithOptionalParametersForAppProfile() { var appName = "testApp.exe"; var result = GenerateResultMock(); var executablePath = Path.Combine(defaultWorkingDir, "Profile"); var executor = GenerateExecutorMock( executablePath, "/wd:" + defaultWorkingDir + " /out:" + Path.Combine(defaultWorkingDir, "somewhereElse.txt") + " /t:240 /ll /ows /sm /sp /rs /is:off /in:off /comp:off /simp:off /notriv:off /e:" + Path.Combine(defaultWorkingDir, appName) + " /args:args /q /v /argfile:" + Path.Combine(defaultWorkingDir, "args.xml") + " /threshold:10", defaultWorkingDir, 600000); var fileSystemMock = this.InitialiseFileSystemMock(executablePath); var logger = mocks.DynamicMock <ILogger>(); var task = new AntsPerformanceProfilerTask(executor, fileSystemMock, logger) { PublishFiles = false }; task.Application = appName; task.Quiet = true; task.Verbose = true; task.XmlArgsFile = "args.xml"; task.OutputFile = "somewhereElse.txt"; task.ApplicationArguments = "args"; task.ProfilerTimeOut = 240; task.TraceLevelValue = AntsPerformanceProfilerTask.TraceLevel.Line; task.OnlyWithSource = true; task.UseSampling = true; task.IncludeSource = false; task.AllowInlining = false; task.Compensate = false; task.SimplifyStackTraces = false; task.AvoidTrivial = false; task.IncludeSubProcesses = true; task.RecordSqlAndIO = true; task.ForceOverwrite = false; task.Threshold = 10; Expect.Call(result.Status).PropertyBehavior(); mocks.ReplayAll(); result.Status = IntegrationStatus.Unknown; task.Run(result); mocks.VerifyAll(); }
public void RunsWithDefaultParametersForAppProfilePublishesAllFiles() { var appName = "testApp.exe"; var result = GenerateResultMock(); var executablePath = Path.Combine(defaultWorkingDir, "Profile"); var executor = GenerateExecutorMock( executablePath, this.defaultExecutableArgs + " /e:" + Path.Combine(defaultWorkingDir, appName) + " /csv:" + Path.Combine(defaultWorkingDir, "summary.csv") + " /xml:" + Path.Combine(defaultWorkingDir, "summary.xml") + " /h:" + Path.Combine(defaultWorkingDir, "summary.html") + " /calltree:" + Path.Combine(defaultWorkingDir, "calltree.xml") + " /cth:" + Path.Combine(defaultWorkingDir, "calltree.html") + " /data:" + Path.Combine(defaultWorkingDir, "data.out"), defaultWorkingDir, 600000); var fileSystemMock = this.InitialiseFileSystemMock(executablePath); ExpectFileCheckAndCopy(fileSystemMock, "AntsPerformanceAnalysis.txt"); ExpectFileCheckAndCopy(fileSystemMock, "summary.csv"); ExpectFileCheckAndCopy(fileSystemMock, "summary.xml"); ExpectFileCheckAndCopy(fileSystemMock, "summary.html"); ExpectFileCheckAndCopy(fileSystemMock, "calltree.xml"); ExpectFileCheckAndCopy(fileSystemMock, "calltree.html"); ExpectFileCheckAndCopy(fileSystemMock, "data.out"); var logger = mocks.DynamicMock <ILogger>(); var task = new AntsPerformanceProfilerTask(executor, fileSystemMock, logger); task.Application = appName; task.SummaryCsvFile = "summary.csv"; task.SummaryXmlFile = "summary.xml"; task.SummaryHtmlFile = "summary.html"; task.CallTreeXmlFile = "calltree.xml"; task.CallTreeHtmlFile = "calltree.html"; task.DataFile = "data.out"; Expect.Call(result.Status).PropertyBehavior(); mocks.ReplayAll(); result.Status = IntegrationStatus.Unknown; task.Run(result); mocks.VerifyAll(); }
public void RunsWithBaseDirectoryForAppProfileAndAllFiles() { var baseDir = "aDirSomewhere"; var appName = "testApp.exe"; var result = GenerateResultMock(); var executablePath = Path.Combine(baseDir, "Profile"); var executor = GenerateExecutorMock( executablePath, "/wd:" + baseDir + " /out:" + Path.Combine(baseDir, "AntsPerformanceAnalysis.txt") + " /t:120 /ml /f /is:on /in:on /comp:on /simp:on /notriv:on /e:" + Path.Combine(baseDir, appName) + " /csv:" + Path.Combine(baseDir, "summary.csv") + " /xml:" + Path.Combine(baseDir, "summary.xml") + " /h:" + Path.Combine(baseDir, "summary.html") + " /calltree:" + Path.Combine(baseDir, "calltree.xml") + " /cth:" + Path.Combine(baseDir, "calltree.html") + " /data:" + Path.Combine(baseDir, "data.out"), baseDir, 600000); var fileSystemMock = this.InitialiseFileSystemMock(executablePath); var logger = mocks.DynamicMock <ILogger>(); var task = new AntsPerformanceProfilerTask(executor, fileSystemMock, logger) { PublishFiles = false }; task.Application = appName; task.BaseDirectory = baseDir; task.SummaryCsvFile = "summary.csv"; task.SummaryXmlFile = "summary.xml"; task.SummaryHtmlFile = "summary.html"; task.CallTreeXmlFile = "calltree.xml"; task.CallTreeHtmlFile = "calltree.html"; task.DataFile = "data.out"; Expect.Call(result.Status).PropertyBehavior(); mocks.ReplayAll(); result.Status = IntegrationStatus.Unknown; task.Run(result); mocks.VerifyAll(); }
public void RunsWithDefaultParametersForServiceProfile() { var appName = "WinService"; var result = GenerateResultMock(); var executablePath = Path.Combine(defaultWorkingDir, "Profile"); var executor = GenerateExecutorMock( executablePath, this.defaultExecutableArgs + " /service:" + appName, defaultWorkingDir, 600000); var fileSystemMock = this.InitialiseFileSystemMock(executablePath); var logger = mocks.Create <ILogger>().Object; var task = new AntsPerformanceProfilerTask(executor, fileSystemMock, logger) { PublishFiles = false }; task.Service = appName; Mock.Get(result).SetupProperty(_result => _result.Status); result.Status = IntegrationStatus.Unknown; task.Run(result); mocks.Verify(); }
public void RunsWithDefaultParametersForAppProfileAndAllFiles() { var appName = "testApp.exe"; var result = GenerateResultMock(); var executablePath = Path.Combine(defaultWorkingDir, "Profile"); var executor = GenerateExecutorMock( executablePath, this.defaultExecutableArgs + " /e:" + Path.Combine(defaultWorkingDir, appName) + " /csv:" + Path.Combine(defaultWorkingDir, "summary.csv") + " /xml:" + Path.Combine(defaultWorkingDir, "summary.xml") + " /h:" + Path.Combine(defaultWorkingDir, "summary.html") + " /calltree:" + Path.Combine(defaultWorkingDir, "calltree.xml") + " /cth:" + Path.Combine(defaultWorkingDir, "calltree.html") + " /data:" + Path.Combine(defaultWorkingDir, "data.out"), defaultWorkingDir, 600000); var fileSystemMock = this.InitialiseFileSystemMock(executablePath); var logger = mocks.Create <ILogger>().Object; var task = new AntsPerformanceProfilerTask(executor, fileSystemMock, logger) { PublishFiles = false }; task.Application = appName; task.SummaryCsvFile = "summary.csv"; task.SummaryXmlFile = "summary.xml"; task.SummaryHtmlFile = "summary.html"; task.CallTreeXmlFile = "calltree.xml"; task.CallTreeHtmlFile = "calltree.html"; task.DataFile = "data.out"; Mock.Get(result).SetupProperty(_result => _result.Status); result.Status = IntegrationStatus.Unknown; task.Run(result); mocks.Verify(); }