public void Conversion_to_BSON_does_not_swallow_invalid_type() { // Arrange var converter = new TimeSpanTypeConverter(); const int integer = 5; // Act/Assert Assert.Throws<InvalidCastException>(() => converter.ConvertToBson(integer)); }
public void Conversion_to_BSON_produces_correct_value() { // Arrange var converter = new TimeSpanTypeConverter(); var timeSpan = new TimeSpan(8, 5, 3); // Act var result = (long)converter.ConvertToBson(timeSpan); // Assert Assert.Equal(timeSpan.Ticks, result); }
public void Converts_TimeSpan_to_a_long() { // Arrange var converter = new TimeSpanTypeConverter(); var timeSpan = new TimeSpan(8, 5, 3); // Act var result = converter.ConvertToBson(timeSpan); // Assert Assert.True(result is long); }