Exemplo n.º 1
0
        public void ValidateTag(string tag, bool isValid)
        {
            var ev = new PersistentEvent {
                Type = Event.KnownTypes.Error, Date = DateTimeOffset.Now, Id = "123456789012345678901234", OrganizationId = "123456789012345678901234", ProjectId = "123456789012345678901234", StackId = "123456789012345678901234"
            };

            ev.Tags.Add(tag);

            var result = _validator.Validate(ev);

            Assert.Equal(isValid, result.IsValid);
        }
        public void RunBenchmark()
        {
            var sw = Stopwatch.StartNew();

            for (int i = 0; i < 10000; i++)
            {
                var result = _validator.Validate(_benchmarkEvent);
                Assert.Equal(true, result.IsValid);
            }
            sw.Stop();

            _logger.Info($"Time: {sw.ElapsedTicks} ticks, Avg: {sw.ElapsedTicks / 10000} ticks");
        }
Exemplo n.º 3
0
        public void RunBenchmark()
        {
            const int iterations = 10000;

            var sw = Stopwatch.StartNew();

            for (int i = 0; i < iterations; i++)
            {
                var result = _validator.Validate(_benchmarkEvent);
                Assert.True(result.IsValid);
            }

            sw.Stop();
            _logger.LogInformation("Time: {Duration:g}, Avg: ({AverageTickDuration:g}ticks | {AverageDuration}ms)", sw.Elapsed, sw.ElapsedTicks / iterations, sw.ElapsedMilliseconds / iterations);
        }
Exemplo n.º 4
0
        public void RunBenchmark()
        {
            const int iterations = 10000;

            var sw = Stopwatch.StartNew();

            for (int i = 0; i < iterations; i++)
            {
                var result = _validator.Validate(_benchmarkEvent);
                Assert.Equal(true, result.IsValid);
            }

            sw.Stop();
            _logger.Info($"Time: {sw.ElapsedMilliseconds}ms, Avg: ({sw.ElapsedTicks / iterations}ticks | {sw.ElapsedMilliseconds / iterations}ms)");
        }