public void Passing_Null_ErrorSelector_Throws() { Assert.Throws <ArgumentNullException>( AssertionUtilities.ErrorSelectorName, () => AssertionUtilities.GetGenderAsync(2).SafeCast <int>(null) ); }
public async Task Result_With_Error_Using_Invalid_Cast_Expects_No_Exception() { const int identity = 3; await AssertionUtilities .GetGenderAsync(identity) .Cast <string>() .AssertError("Could not determine gender."); }
public async Task Result_With_Value_Using_Valid_Cast_Expects_Value_As_Int() { const int identity = 0; await AssertionUtilities .GetGenderAsync(identity) .Cast <int>() .AssertValue(identity); }
public Task With_Error_Double_Type_Throws() { var result = AssertionUtilities.GetGenderAsync(int.MaxValue).Map(x => (int)x); return(Assert.ThrowsAsync <InvalidCastException>( async() => await result.FullCast <AssertionUtilities.Gender, AssertionUtilities.Error>() )); }
public void Result_With_Value_Using_Valid_Cast_Expects_Value_As_Int() { const int identity = 0; AssertionUtilities .GetGenderAsync(identity) .SafeCast <int>(gender => "ERROR") .AssertValue(identity); }
public void Result_With_Error_Using_Valid_Cast_Expects_Error() { const int identity = 3; AssertionUtilities .GetGenderAsync(identity) .SafeCast <int>(gender => "ERROR") .AssertError("Could not determine gender."); }
public void With_Valid_Value_Valid_Cast_Double_Type() { var result = AssertionUtilities.GetGenderAsync(0).Map(x => (int)x); Assert.Null( Record.Exception( () => result.FullCast <AssertionUtilities.Gender, AssertionUtilities.Error>() ) ); }
public async Task Result_With_Value_Using_Invalid_Cast_Expects_Cast_Exception() { const int identity = 0; await Assert.ThrowsAsync <InvalidCastException>(async() => await AssertionUtilities.GetGenderAsync(identity).Cast <string>()); }
public void Result_With_Value_Using_Invalid_Cast_Expects_Cast_Exception() { AssertionUtilities.GetGenderAsync(0) .SafeCast <int>(gender => "ERROR"); }