public void If_first_site_download_is_failed_Then_result_should_contain_second_successful_download() { var errors = new List <Exception>(); var result = Await.Many( (x, _) => x.OnError(errors.Add).Match(Some.Of, None.Of <string>()), null, DownloadAsync("http://ד�ד�.com"), DownloadAsync("http://www.codeproject.com/")) .WaitSuccess(); Assert.That(result, Is.StringContaining("codeproject")); }
public void If_both_sites_downloads_are_failed_Then_result_should_be_none_and_errors_list_should_contain_two_items() { var errors = new List <Exception>(); var result = Await.Many( (x, _) => x.OnError(errors.Add).Match(Some.Of, ex => None.Of <string>()), null, DownloadAsync("http://ד�ד�.com"), DownloadAsync("http://ץוץו.com")) .WaitSuccess(); Assert.That(result, Is.Null); Assert.That(errors.Count, Is.EqualTo(2)); }
public void Simple_joinad_test() { var result = Await.Many( Timer(1000), Timer(100), 0, (x, y) => Some.Of( x.IsSome && y.IsNone ? 1 : x.IsNone && y.IsSome ? 2 : 3) ).WaitSuccess(); Assert.AreEqual(2, result); }