public bool Equals(TestObject other) { return(IntValue == other.IntValue && (NullableIntValue == null && other.NullableIntValue == null) || NullableIntValue.Equals(other.NullableIntValue) && DecimalValue == other.DecimalValue && (NullableDecimalValue == null && other.NullableDecimalValue == null) || NullableDecimalValue.Equals(other.NullableDecimalValue) && (StringValue == null && other.StringValue == null) || StringValue.Equals(other.StringValue) && DateValue == other.DateValue && (NullableDateValue == null && other.NullableDateValue == null) || NullableDateValue.Equals(other.NullableDateValue) && TimeSpanValue == other.TimeSpanValue && (NullableDateValue == null && other.NullableDateValue == null) || NullableDateValue.Equals(other.NullableDateValue) && (IntArray == null && other.IntArray == null) || IntArray.SequenceEqual(other.IntArray) && (IntCollection == null && other.IntCollection == null) || IntCollection.SequenceEqual(other.IntCollection) && GuidValue == other.GuidValue && (NullableGuidValue == null && other.NullableGuidValue == null) || NullableGuidValue.Equals(other.NullableGuidValue) ); }
public void ReadRow_AutoMappedNullableInt_Success() { using (var importer = Helpers.GetImporter("Numbers.xlsx")) { ExcelSheet sheet = importer.ReadSheet(); sheet.ReadHeading(); // Valid cell value. NullableIntValue row1 = sheet.ReadRow <NullableIntValue>(); Assert.Equal(2, row1.Value); // Empty cell value. NullableIntValue row2 = sheet.ReadRow <NullableIntValue>(); Assert.Null(row2.Value); // Invalid cell value. Assert.Throws <ExcelMappingException>(() => sheet.ReadRow <IntValue>()); } }
public void ReadRow_CustomMappedNullableInt_Success() { using (var importer = Helpers.GetImporter("Numbers.xlsx")) { importer.Configuration.RegisterClassMap <NullableIntValueFallbackMap>(); ExcelSheet sheet = importer.ReadSheet(); sheet.ReadHeading(); // Valid cell value. NullableIntValue row1 = sheet.ReadRow <NullableIntValue>(); Assert.Equal(2, row1.Value); // Empty cell value. NullableIntValue row2 = sheet.ReadRow <NullableIntValue>(); Assert.Equal(-10, row2.Value); // Invalid cell value. NullableIntValue row3 = sheet.ReadRow <NullableIntValue>(); Assert.Equal(10, row3.Value); } }