From 84f1c4e180c420c0a48ca9559e6c5f5c3fa27ea1 Mon Sep 17 00:00:00 2001 From: Andres Gutierrez Date: Wed, 18 Oct 2023 11:30:09 -0500 Subject: [PATCH] Added LazyTask tests --- Nixie.Tests/TestLazyAsync.cs | 24 ++++++++++++++++++++++++ Nixie/LazyTaskMethodBuilder.cs | 6 +++++- 2 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 Nixie.Tests/TestLazyAsync.cs diff --git a/Nixie.Tests/TestLazyAsync.cs b/Nixie.Tests/TestLazyAsync.cs new file mode 100644 index 0000000..60572ae --- /dev/null +++ b/Nixie.Tests/TestLazyAsync.cs @@ -0,0 +1,24 @@ + +namespace Nixie.Tests; + +public class SomeResultAsync +{ + +} + +[Collection("Nixie")] +public class TestLazyAsync +{ + [Fact] + public async Task TestAskMessageToSingleActor() + { + LazyTask task = CreateResultAsync(); + Assert.NotNull(await task); + } + + private async LazyTask CreateResultAsync() + { + await Task.Delay(100); + return new SomeResultAsync(); + } +} \ No newline at end of file diff --git a/Nixie/LazyTaskMethodBuilder.cs b/Nixie/LazyTaskMethodBuilder.cs index d4b0542..77746c3 100644 --- a/Nixie/LazyTaskMethodBuilder.cs +++ b/Nixie/LazyTaskMethodBuilder.cs @@ -1,4 +1,6 @@  +#pragma warning disable CA1000 + using System.Runtime.CompilerServices; namespace Nixie; @@ -7,7 +9,7 @@ public class LazyTaskMethodBuilder { public LazyTaskMethodBuilder() => Task = new LazyTask(); - //public static LazyTaskMethodBuilder Create() => new(); + public static LazyTaskMethodBuilder Create() => new(); public void Start(ref TStateMachine stateMachine) where TStateMachine : IAsyncStateMachine { @@ -42,3 +44,5 @@ public void GenericAwaitOnCompleted(ref TAwaiter awaite public LazyTask Task { get; } } + +#pragma warning restore CA1000 \ No newline at end of file