public StackServiceTests(ITestOutputHelper output, AppWebHostFactory factory) : base(output, factory) { Log.SetLogLevel <StackService>(LogLevel.Trace); _cache = GetService <ICacheClient>(); _stackService = GetService <StackService>(); _stackRepository = GetService <IStackRepository>(); }
public void CalculatePercent(long totalCount, long uses, decimal result) { var service = new StackService(); var percent = service.CalculatePercent(totalCount, uses); Assert.That(percent, Is.EqualTo(result)); }
public void TwoHundredTwentyTwoCount_ShouldReturn_GoodLoop() { var service = new StackService(); var loop = service.GetPagination(222); Assert.That(loop.Page, Is.EqualTo(3)); Assert.That(loop.ItemsCount, Is.EqualTo(100)); }
public void FiftyFour_ShouldReturn_GoodLoop() { var service = new StackService(); var loop = service.GetPagination(54); Assert.That(loop.Page, Is.EqualTo(1)); Assert.That(loop.ItemsCount, Is.EqualTo(54)); }
public AggregationTests(ITestOutputHelper output) : base(output) { _pipeline = GetService <EventPipeline>(); _eventRepository = GetService <IEventRepository>(); _stackRepository = GetService <IStackRepository>(); _organizationRepository = GetService <IOrganizationRepository>(); _projectRepository = GetService <IProjectRepository>(); _stackService = GetService <StackService>(); }
public void OneHundred_ShouldReturn_GoodLoop() { var service = new StackService(); var loop = service.GetPagination(100); Assert.That(loop.Page, Is.EqualTo(1)); Assert.That(loop.ItemsCount, Is.EqualTo(100)); }
public void ZeroCount_ShouldReturn_DefaultLoop() { var service = new StackService(); var loop = service.GetPagination(0); Assert.That(loop.Page, Is.EqualTo(1)); Assert.That(loop.ItemsCount, Is.EqualTo(1)); }
public AggregationTests(ITestOutputHelper output, AppWebHostFactory factory) : base(output, factory) { _pipeline = GetService <EventPipeline>(); _eventRepository = GetService <IEventRepository>(); _stackRepository = GetService <IStackRepository>(); _organizationRepository = GetService <IOrganizationRepository>(); _projectRepository = GetService <IProjectRepository>(); _stackService = GetService <StackService>(); _billingManager = GetService <BillingManager>(); _plans = GetService <BillingPlans>(); }
public void Finish(long iterations) { endCycleCount = unchecked ((long)Processor.CycleCount); #if X64_PERF x64_p0 = Processor.ReadPmc(0); x64_p1 = Processor.ReadPmc(1); x64_p2 = Processor.ReadPmc(2); x64_p3 = Processor.ReadPmc(3); #endif endInterruptCount = ProcessService.GetKernelInterruptCount(); endSwitchCount = ProcessService.GetContextSwitchCount(); endKernelGcCount = ProcessService.GetKernelGcCount(); int collectorCount; long collectorMillis; long collectorBytes; GC.PerformanceCounters(out collectorCount, out collectorMillis, out collectorBytes); endProcessGcCount = collectorCount; ulong allocatedCount; ulong allocatedBytes; ulong freedCount; ulong freedBytes; PageTableService.GetUsageStatistics(out allocatedCount, out allocatedBytes, out freedCount, out freedBytes); endAllocatedCount = allocatedCount; endAllocatedBytes = allocatedBytes; endFreedCount = freedCount; endFreedBytes = freedBytes; ulong stackGets; ulong stackRets; StackService.GetUsageStatistics(out stackGets, out stackRets); endStackGets = stackGets; endStackRets = stackRets; if (!AtRing3) { Processor.RestoreLocalPreemption(disabled); } this.iterations = iterations; }
public void Run() { Console.CancelKeyPress += new ConsoleCancelEventHandler(this.OnExit); using (App.databaseConnection = new SqliteConnection("" + new SqliteConnectionStringBuilder { DataSource = "hello.db" })) { App.databaseConnection.Open(); var prog = new DataCollector(); edges = new List <Tuple <string, string> >(); while (StackService.Count().Result > 0) { var url = StackService.GetUrlFromStack().Result; var info = WebService.GetInfoFromUrl(url).Result; if (info == null) { continue; } NodeService.InsertNewNode(url, info.Html, info.Title); foreach (var x in info.Urls) { StackService.PutUrlInStack(x).Wait(); edges.Add(new Tuple <string, string>(url, x)); } if (edges.Count > 10000) { EdgeService.AddEdges(edges).Wait(); edges = new List <Tuple <string, string> >(); } Console.WriteLine("Got " + info.Urls.Count() + " new urls"); } EdgeService.AddEdges(edges).Wait(); Console.WriteLine(StackService.Count().Result); StackService.CommitAllUrlsToDatabase().Wait(); Console.WriteLine(StackService.Count().Result); } }
public void TestTheBug() { // arrange var stack = new StackService(); stack.PushToStack(1); stack.PushToStack(2); stack.PushToStack(3); stack.PushToStack(4); stack.PushToStack(5); int[] result = stack.PopAllItemsAndReturnResult(); // assert Assert.AreEqual(5, result[0]); Assert.AreEqual(4, result[1]); Assert.AreEqual(3, result[2]); Assert.AreEqual(2, result[3]); Assert.AreEqual(1, result[4]); }
public MyStackTests() { _stackService = new StackService(); }
public UpdateStatsAction(StackService stackService, AppOptions options, ILoggerFactory loggerFactory = null) : base(options, loggerFactory) { _stackService = stackService; }
public StackService_PushToStackShould() { _stackService = new StackService(); }
public StackService_ResetStackShould() { _stackService = new StackService(); }
public PratikStackTest() { _stackService = new StackService(); }
public void Start() { if (!AtRing3) { disabled = Processor.DisableLocalPreemption(); } int collectorCount; long collectorMillis; long collectorBytes; GC.PerformanceCounters(out collectorCount, out collectorMillis, out collectorBytes); ulong stackGets; ulong stackRets; StackService.GetUsageStatistics(out stackGets, out stackRets); begStackGets = stackGets; begStackRets = stackRets; ulong allocatedCount; ulong allocatedBytes; ulong freedCount; ulong freedBytes; PageTableService.GetUsageStatistics(out allocatedCount, out allocatedBytes, out freedCount, out freedBytes); begAllocatedCount = allocatedCount; begAllocatedBytes = allocatedBytes; begFreedCount = freedCount; begFreedBytes = freedBytes; begInterruptCount = ProcessService.GetKernelInterruptCount(); begSwitchCount = ProcessService.GetContextSwitchCount(); begKernelGcCount = ProcessService.GetKernelGcCount(); begProcessGcCount = collectorCount; #if x64_PERF // Set up for perf counting if (!AtRing3) { // Reset the performance counters to what we're interested in. Reset(0, PerfEvtSel.COUNT | PerfEvtSel.CyclesNotHalted); Reset(1, PerfEvtSel.COUNT | PerfEvtSel.RetiredInstructions); Reset(2, PerfEvtSel.COUNT | PerfEvtSel.RetiredBranchInstructions); Reset(3, PerfEvtSel.COUNT | PerfEvtSel.RequestsToL2Cache | 0x400); } else { // We're not allowed to reset the perf counters, so take note // of their current values; we will subtract from this later. x64_i0 = Processor.ReadPmc(0); x64_i1 = Processor.ReadPmc(1); x64_i2 = Processor.ReadPmc(2); x64_i3 = Processor.ReadPmc(3); } #endif begCycleCount = unchecked ((long)Processor.CycleCount); }
public void OnExit(object sender, EventArgs e) { Console.WriteLine("saved all the good shit"); StackService.CommitAllUrlsToDatabase().Wait(); EdgeService.AddEdges(edges); }
public BMartinStackTest() { _stackService = new StackService(); }
public void SetUp() { _stackService = new StackService(); CreateStack(); }
public StackEventCountJob(StackService stackService, ICacheClient cacheClient, ILoggerFactory loggerFactory = null) : base(loggerFactory) { _stackService = stackService; _lockProvider = new ThrottlingLockProvider(cacheClient, 1, TimeSpan.FromSeconds(5)); }
internal MySyncXcapCallback(StackService stackService) { this.stackService = stackService; }
public UpdateStatsAction(StackService stackService, ILoggerFactory loggerFactory = null) : base(loggerFactory) { _stackService = stackService; }
public void SetUp() { CloudFormationMock = new Mock <IAmazonCloudFormation>(); StorageServiceMock = new Mock <IStorageService>(); StackService = new StackService(CloudFormationMock.Object, StorageServiceMock.Object, string.Empty); }