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); }
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); }
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); }