Headless CMS and Content Managment Hub
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

69 lines
1.8 KiB

// ==========================================================================
// Squidex Headless CMS
// ==========================================================================
// Copyright (c) Squidex UG (haftungsbeschraenkt)
// All rights reserved. Licensed under the MIT license.
// ==========================================================================
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using LoadTest.Model;
using Xunit;
namespace LoadTest
{
public class WritingBenchmarks : IClassFixture<WritingFixture>
{
public WritingFixture Fixture { get; }
public WritingBenchmarks(WritingFixture fixture)
{
Fixture = fixture;
}
public static IEnumerable<object[]> Loads()
{
int[] users =
{
1,
5,
10,
20,
50,
100
};
int[] loads =
{
5,
10,
20,
50,
100
};
foreach (var user in users)
{
foreach (var load in loads)
{
yield return new object[] { user, load };
}
}
yield return new object[] { 1, 50000 };
}
[Theory]
[MemberData(nameof(Loads))]
public async Task Should_create_items(int numUsers, int numIterationsPerUser)
{
var random = new Random();
await Run.Parallel(numUsers, numIterationsPerUser, async () =>
{
await Fixture.Client.CreateAsync(new TestEntityData { Number = random.Next() }, true);
});
}
}
}