public async Task ReturnDelegateResult(string identifier)
    {
        var strategy = new DelegateStrategy(async c => await Task.FromResult(identifier));
        var result   = await strategy.GetIdentifierAsync(new object());

        Assert.Equal(identifier, result);
    }
예제 #2
0
    public async Task ReturnDelegateResult()
    {
        var strategy = new DelegateStrategy(c => Task.FromResult("test_test"));
        var result   = await strategy.GetIdentifierAsync(new object());

        Assert.Equal("test_test", result);
    }
예제 #3
0
        public async Task BeAbleToReturnNull()
        {
            var strategy = new DelegateStrategy(async _ => await Task.FromResult <string?>(null));
            var result   = await strategy.GetIdentifierAsync(new object());

            Assert.Null(result);
        }
    public void CallDelegate()
    {
        int i        = 0;
        var strategy = new DelegateStrategy(c => Task.FromResult((i++).ToString()));

        strategy.GetIdentifierAsync(new object()).Wait();

        Assert.Equal(1, i);
    }