public override int GetHashCode() { unchecked { var hashCode = Amount.GetHashCode(); hashCode = (hashCode * 397) ^ Value.GetHashCode(); hashCode = (hashCode * 397) ^ (ValueType != null ? ValueType.GetHashCode() : 0); hashCode = (hashCode * 397) ^ Applicable.GetHashCode(); hashCode = (hashCode * 397) ^ (NonApplicableReason != null ? NonApplicableReason.GetHashCode() : 0); return(hashCode); } }
public void TestThatFailedHasApplicable() { var applicable = new Applicable <object>(null, Enumerable.Empty <ISource>(), Metadata.NullMetadata(), CompletionSupplier <object> .SupplierOrNull <object>(() => null, null)); var e = new ApplyFailedException <object>(applicable); Assert.NotNull(e); Assert.NotNull(e.Applicable); Assert.Null(e.Applicable.State); Assert.NotNull(e.Applicable.Sources); Assert.NotNull(e.Applicable.Metadata); Assert.NotNull(e.Applicable.CompletionSupplier); Assert.Equal("Exception of type 'Vlingo.Xoom.Lattice.Model.ApplyFailedException`1[System.Object]' was thrown.", e.Message); Assert.Null(e.InnerException); }
public void TestThatFailedHasExceptionInfo() { var cause = new Exception("TestInner", new Exception()); var applicable = new Applicable <object>(null, Enumerable.Empty <ISource>(), Metadata.NullMetadata(), CompletionSupplier <object> .SupplierOrNull <object>(() => null, null)); var e = new ApplyFailedException <object>(applicable, "TestOuter", cause); Assert.NotNull(e); Assert.NotNull(e.Applicable); Assert.Equal("TestOuter", e.Message); Assert.NotNull(e.InnerException); Assert.Equal("TestInner", e.InnerException.Message); Assert.NotNull(e.Message); Assert.NotNull(e.InnerException.InnerException); Assert.Equal("Exception of type 'System.Exception' was thrown.", e.InnerException.InnerException.Message); }