Compare commits

...

2 commits

Author SHA1 Message Date
D. Moonfire da16d3f28e fix: switching Is* and Has* classes into singletons
All checks were successful
deploy / deploy (push) Successful in 8m29s
2024-03-10 23:33:43 -05:00
D. Moonfire 8944ae37ab test: switched to async/await for lock tests 2024-03-10 22:55:22 -05:00
5 changed files with 25 additions and 27 deletions

View file

@ -90,7 +90,7 @@ public partial class ExecOperation : AsyncOperationBase
CommandResult result = await command.ExecuteAsync(cancellationToken); CommandResult result = await command.ExecuteAsync(cancellationToken);
this.logger.Debug( this.logger.Debug(
"Execute: {Command} {Arguments} = {ExitCode}", "Execute non-buffered: {Command} {Arguments} = {ExitCode}",
command.TargetFilePath, command.TargetFilePath,
command.Arguments, command.Arguments,
result.ExitCode result.ExitCode

View file

@ -1,12 +1,10 @@
using MfGames.Nitride.Generators;
namespace MfGames.Nitride.Feeds; namespace MfGames.Nitride.Feeds;
/// <summary> /// <summary>
/// A marker component that indicates this entity has a feed associated with /// A marker component that indicates this entity has a feed associated with
/// it. /// it.
/// </summary> /// </summary>
public class HasFeed [SingletonComponent]
{ public partial class HasFeed { }
public HasFeed() { }
public static HasFeed Instance { get; } = new();
}

View file

@ -1,10 +1,10 @@
using MfGames.Nitride.Generators;
namespace MfGames.Nitride.Handlebars; namespace MfGames.Nitride.Handlebars;
/// <summary> /// <summary>
/// A marker component that indicates that a given file with text component /// A marker component that indicates that a given file with text component
/// has a Handlebars template in it. /// has a Handlebars template in it.
/// </summary> /// </summary>
public record HasHandlebarsTemplate [SingletonComponent]
{ public partial class HasHandlebarsTemplate { }
public static HasHandlebarsTemplate Instance { get; } = new();
}

View file

@ -1,9 +1,9 @@
using MfGames.Nitride.Generators;
namespace MfGames.Nitride.Yaml; namespace MfGames.Nitride.Yaml;
/// <summary> /// <summary>
/// A marker class that indicates that entity has a YAML model. /// A marker class that indicates that entity has a YAML model.
/// </summary> /// </summary>
public record HasYamlModel [SingletonComponent]
{ public partial class HasYamlModel { }
public static HasYamlModel Instance { get; } = new();
}

View file

@ -24,9 +24,9 @@ public class LockTests
} }
[Fact] [Fact]
public void ReadBlocksWrite() public async Task ReadBlocksWrite()
{ {
Task.WaitAll( await Task.WhenAll(
Task.Run(() => this.TestRead(1, 5, 1)), Task.Run(() => this.TestRead(1, 5, 1)),
Task.Run(() => this.TestWrite(2, 2, 2)) Task.Run(() => this.TestWrite(2, 2, 2))
); );
@ -42,9 +42,9 @@ public class LockTests
} }
[Fact] [Fact]
public void ReadsDoNotBlockReads() public async Task ReadsDoNotBlockReads()
{ {
Task.WaitAll( await Task.WhenAll(
Task.Run(() => this.TestRead(1, 8, 1)), Task.Run(() => this.TestRead(1, 8, 1)),
Task.Run(() => this.TestRead(2, 1, 2)), Task.Run(() => this.TestRead(2, 1, 2)),
Task.Run(() => this.TestRead(4, 1, 3)) Task.Run(() => this.TestRead(4, 1, 3))
@ -64,9 +64,9 @@ public class LockTests
} }
[Fact] [Fact]
public void UpgradableBlocksUpgradable() public async Task UpgradableBlocksUpgradable()
{ {
Task.WaitAll( await Task.WhenAll(
Task.Run(() => this.TestUpgradable(1, 10, 1)), Task.Run(() => this.TestUpgradable(1, 10, 1)),
Task.Run(() => this.TestUpgradable(2, 2, 2)), Task.Run(() => this.TestUpgradable(2, 2, 2)),
Task.Run(() => this.TestUpgradable(5, 1, 3)) Task.Run(() => this.TestUpgradable(5, 1, 3))
@ -86,9 +86,9 @@ public class LockTests
} }
[Fact] [Fact]
public void UpgradableDoesNotBlockReads() public async Task UpgradableDoesNotBlockReads()
{ {
Task.WaitAll( await Task.WhenAll(
Task.Run(() => this.TestUpgradable(1, 6, 1)), Task.Run(() => this.TestUpgradable(1, 6, 1)),
Task.Run(() => this.TestRead(2, 1, 2)), Task.Run(() => this.TestRead(2, 1, 2)),
Task.Run(() => this.TestRead(4, 1, 3)) Task.Run(() => this.TestRead(4, 1, 3))
@ -108,9 +108,9 @@ public class LockTests
} }
[Fact] [Fact]
public void WriteBlockRead() public async Task WriteBlockRead()
{ {
Task.WaitAll( await Task.WhenAll(
Task.Run(() => this.TestWrite(1, 6, 1)), Task.Run(() => this.TestWrite(1, 6, 1)),
Task.Run(() => this.TestRead(2, 1, 2)) Task.Run(() => this.TestRead(2, 1, 2))
); );
@ -126,9 +126,9 @@ public class LockTests
} }
[Fact] [Fact]
public void WriteBlockReads() public async Task WriteBlockReads()
{ {
Task.WaitAll( await Task.WhenAll(
Task.Run(() => this.TestWrite(1, 6, 1)), Task.Run(() => this.TestWrite(1, 6, 1)),
Task.Run(() => this.TestRead(2, 1, 2)) Task.Run(() => this.TestRead(2, 1, 2))
); );