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