mirror of
https://github.com/AlexMacocian/SystemExtensions.git
synced 2026-07-24 03:56:27 +00:00
Update dependencies (#16)
* Update dependencies Implement AsyncLazy Fix namespaces Fix CD pipeline * Fix code issues Fix Int64BitStruct test
This commit is contained in:
@@ -0,0 +1,47 @@
|
||||
using FluentAssertions;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace System.Tests;
|
||||
|
||||
[TestClass]
|
||||
public class AsyncLazyTests
|
||||
{
|
||||
private const string Value = "Value";
|
||||
|
||||
[TestMethod]
|
||||
public async Task ValueFactoryConstructor_AwaitsAndReturnsValue()
|
||||
{
|
||||
var asyncLazy = new AsyncLazy<string>(() => Value);
|
||||
|
||||
var value = await asyncLazy;
|
||||
|
||||
value.Should().Be(Value);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public async Task TaskFactoryConstructor_AwaitsAndReturnsValue()
|
||||
{
|
||||
var asyncLazy = new AsyncLazy<string>(GetValueTask);
|
||||
|
||||
var value = await asyncLazy;
|
||||
|
||||
value.Should().Be(Value);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public async Task Value_ReturnsValue()
|
||||
{
|
||||
var asyncLazy = new AsyncLazy<string>(GetValueTask);
|
||||
|
||||
var value = await asyncLazy.Value;
|
||||
|
||||
value.Should().Be(Value);
|
||||
}
|
||||
|
||||
private static async Task<string> GetValueTask()
|
||||
{
|
||||
await Task.Delay(10);
|
||||
return Value;
|
||||
}
|
||||
}
|
||||
@@ -52,7 +52,7 @@ namespace System.Threading.Tests
|
||||
var x = threadPool.NumberOfThreads;
|
||||
Assert.Fail();
|
||||
}
|
||||
catch(Exception e)
|
||||
catch (Exception)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user