public void AddNew() { //Arrange AddNewCarRequest addNewCarRequest = new AddNewCarRequest("BMW", 1999); string json = JsonSerializer.Serialize(addNewCarRequest); StringContent content = new StringContent(json, Encoding.UTF8, "application/json"); var step = HttpStep.Create("addNew", ctx => Task.FromResult(Http.CreateRequest("POST", endpoint) .WithBody(content) )); var scenario = ScenarioBuilder.CreateScenario("Add", step) .WithoutWarmUp() .WithLoadSimulations(Simulation.KeepConstant(2, TimeSpan.FromSeconds(30))); //Act NodeStats nodeStats = NBomberRunner.RegisterScenarios(scenario).Run(); //Assert nodeStats.OkCount.Should().Be(nodeStats.RequestCount); StepStats stepStats = nodeStats.ScenarioStats[0].StepStats[0]; stepStats.RPS.Should().BeGreaterOrEqualTo(1500); }
public static void PrintSpectrum(StringBuilder builder, StageExecution execution, int width, DetailLevel additionalStatsLevel) { long[] values = values(execution); long total = total(values); // reduce the width with the known extra characters we know we'll print in and around the spectrum width -= 2 + PROGRESS_WIDTH; //JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET: //ORIGINAL LINE: org.neo4j.helpers.collection.Pair<Step<?>,float> bottleNeck = execution.stepsOrderedBy(org.neo4j.unsafe.impl.batchimport.stats.Keys.avg_processing_time, false).iterator().next(); Pair <Step <object>, float> bottleNeck = execution.StepsOrderedBy(Keys.avg_processing_time, false).GetEnumerator().next(); QuantizedProjection projection = new QuantizedProjection(total, width); long lastDoneBatches = 0; int stepIndex = 0; bool hasProgressed = false; builder.Append('['); //JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET: //ORIGINAL LINE: for (Step<?> step : execution.steps()) foreach (Step <object> step in execution.Steps()) { StepStats stats = step.Stats(); if (!projection.Next(values[stepIndex])) { break; // odd though } long stepWidth = total == 0 && stepIndex == 0 ? width : projection.Step(); if (stepWidth > 0) { if (hasProgressed) { stepWidth--; builder.Append('|'); } bool isBottleNeck = bottleNeck.First() == step; string name = (isBottleNeck ? "*" : "") + stats.ToString(additionalStatsLevel) + (step.Processors(0) > 1 ? "(" + step.Processors(0) + ")" : ""); int charIndex = 0; // negative value "delays" the text, i.e. pushes it to the right char backgroundChar = step.Processors(0) > 1 ? '=' : '-'; for (int i = 0; i < stepWidth; i++, charIndex++) { char ch = backgroundChar; if (charIndex >= 0 && charIndex < name.Length && charIndex < stepWidth) { ch = name[charIndex]; } builder.Append(ch); } hasProgressed = true; } lastDoneBatches = stats.Stat(Keys.done_batches).asLong(); stepIndex++; } long progress = lastDoneBatches * execution.Config.batchSize(); builder.Append("]").Append(FitInProgress(progress)); }