public void CSharpTestOperation1_SmallTimeMultipleRunPassingFunction_ShouldBeCapturedByStopWatchProfiler() { using (perfLabs.Step(Profiler.PerfLabsStopWatch, "AnonymousOperation1", 0, 2, () => sampleCode.CSharpTestOperation1())) { } using (var context = new Test_PerformanceLabsDBContext()) { Int32 count = (from swpt in context.StopWatchProfilerTimings where swpt.Name == "AnonymousOperation1" && swpt.MethodRunCounts == 2 select swpt.Name).Count(); Assert.AreEqual(count, 1); } }
public void CSharpTestOperation1_SmallTimeTrue_ShouldBeCapturedByStopWatchProfiler() { using (perfLabs.Step(Profiler.PerfLabsStopWatch, "CSharpTestOperation2")) { sampleCode.CSharpTestOperation1(true); } using (var context = new Test_PerformanceLabsDBContext()) { Int32 count = (from swpt in context.StopWatchProfilerTimings where swpt.Name == "CSharpTestOperation2" select swpt.Name).Count(); Assert.AreEqual(count, 1); } }
public void SetUp() { ///DO NOT DELETE THIS COMMENTED CODE //string nunitConfig = AppDomain.CurrentDomain.SetupInformation.ConfigurationFile; //string appConfig = Path.GetFileName(Assembly.GetExecutingAssembly().Location) + ".config"; //File.Copy(appConfig, nunitConfig, true); context = new TestDBBlogContext(); context.Database.CreateIfNotExists(); contextTestDBPLabs = new Test_PerformanceLabsDBContext(); contextTestDBPLabs.Database.CreateIfNotExists(); perfLabs = new PerformanceLabsFramework.PerformanceLabs(); MakeProfilerSettings(); perfLabs.StartProfilers(); }
public void CSharpTestOperation1_SmallTimeTrue_ShouldBeCapturedByProfiler() { using (perfLabs.Step(Profiler.MVCMiniProfiler, "CSharpTestOperation1")) { sampleCode.CSharpTestOperation1(true); } perfLabs.SaveToDataBase(); using (var context = new Test_PerformanceLabsDBContext()) { Int32 count = (from mpt in context.MiniProfilerTimings where mpt.Name == "CSharpTestOperation1" select mpt.Name).Count(); Assert.AreEqual(count, 1); } }
public static void Cleanup() { using (var context = new Test_PerformanceLabsDBContext()) { context.Database.ExecuteSqlCommand("delete from MiniProfilerSqlTimingParameters"); context.Database.ExecuteSqlCommand("delete from MiniProfilerSqlTimings"); context.Database.ExecuteSqlCommand("delete from MiniProfilerSqlTimings"); context.Database.ExecuteSqlCommand("delete from MiniProfilerTimings"); context.Database.ExecuteSqlCommand("delete from MiniProfilerClientTimings"); context.Database.ExecuteSqlCommand("delete from MiniProfilers"); context.Database.ExecuteSqlCommand("delete from StopWatchProfilers"); context.Database.ExecuteSqlCommand("delete from MiniProfilers"); context.Database.ExecuteSqlCommand("delete from RegressionArchive"); } }
public void CSharpTestOperation1_SmallTimeTrueWithMultipleRuns_ShouldBeCapturedByStopWatchProfiler() { Int32 methodRunCount = 5; using (perfLabs.Step(Profiler.PerfLabsStopWatch, "CSharpTestOperation3", 0, methodRunCount)) { sampleCode.CSharpTestOperation1(true); } using (var context = new Test_PerformanceLabsDBContext()) { Int32 count = (from swpt in context.StopWatchProfilerTimings where swpt.Name == "CSharpTestOperation3" && swpt.MethodRunCounts == methodRunCount select swpt.Name).Count(); Assert.AreEqual(count, 1); } }
public void CSharpTestOperation1_OperationLevelThresholdsGiven_ShouldSaveThresholdDataInStopWatchTimingColumn() { Int32 timing = 20; using (perfLabs.Step(Profiler.PerfLabsStopWatch, "CSharpTestOperation6", timing)) { sampleCode.CSharpTestOperation1(true); } using (var context = new Test_PerformanceLabsDBContext()) { Int32 count = (from swpt in context.StopWatchProfilerTimings where swpt.Name == "CSharpTestOperation6" && swpt.ThresholdOperationTiming == timing select swpt.Name).Count(); Assert.AreEqual(count, 1); } }
public void SqlConnectionTestOperation_OperationLevelThresholdsGiven_ShouldSaveThresholdDataInTableMiniProfilerOperationThresholds() { Int32 timing = 20; using (perfLabs.Step(Profiler.MVCMiniProfiler, "SqlConnectionTestOperation2", timing)) { sampleCode.SqlConnectionTestOperation(true); } using (var context = new Test_PerformanceLabsDBContext()) { Int32 count = (from mpot in context.MiniProfilerOperationThresholds where mpot.OperationName == "SqlConnectionTestOperation2" && mpot.ThresholdOperationTiming == timing select mpot.OperationName).Count(); Assert.AreEqual(count, 1); } }
public void SqlConnectionTestOperation_SmallTimeTrue_SqlShouldBeCapturedByProfiler() { using (perfLabs.Step(Profiler.MVCMiniProfiler, "SqlConnectionTestOperation")) { sampleCode.SqlConnectionTestOperation(true); } perfLabs.SaveToDataBase(); using (var context = new Test_PerformanceLabsDBContext()) { Int32 count = (from mpct in context.MiniProfilerTimings join mpst in context.MiniProfilerSqlTimings on mpct.Id equals mpst.ParentTimingId where mpct.Name == "SqlConnectionTestOperation" select mpst.Id).Count(); Assert.AreEqual(count, 1); } }