public void Conversion_from_BSON_does_not_swallow_invalid_type() { // Arrange var converter = new TimeSpanTypeConverter(); var obj = new Object(); // Act/Assert Assert.Throws<InvalidCastException>(() => converter.ConvertFromBson(obj)); }
public void Converts_a_long_to_Timespan() { // Arrange var converter = new TimeSpanTypeConverter(); const long value = 4234234234; // Act var result = converter.ConvertFromBson(value); // Assert Assert.True(result is TimeSpan); }
public void Conversion_from_BSON_produces_correct_value() { // Arrange var converter = new TimeSpanTypeConverter(); const long value = 65435432112312; var timeSpan = TimeSpan.FromTicks(value); // Act var result = (TimeSpan)converter.ConvertFromBson(value); // Assert Assert.Equal(timeSpan, result); }