public void Should_use_inherited_TimeToBeReceived_when_tryget() { var mappings = new TimeToBeReceivedMappings(new Type[] { }, TimeToBeReceivedMappings.DefaultConvention, true); Assert.True(mappings.TryGetTimeToBeReceived(typeof(InheritedClassWithNoAttribute), out var timeToBeReceived)); Assert.AreEqual(TimeSpan.FromSeconds(1), timeToBeReceived); }
public void Should_use_TimeToBeReceived_from_bottom_of_tree_when_initialized() { var mappings = new TimeToBeReceivedMappings(new[] { typeof(InheritedClassWithAttribute) }, TimeToBeReceivedMappings.DefaultConvention, true); Assert.True(mappings.TryGetTimeToBeReceived(typeof(InheritedClassWithAttribute), out var timeToBeReceived)); Assert.AreEqual(TimeSpan.FromSeconds(2), timeToBeReceived); }
public void Should_use_inherited_TimeToBeReceived_when_tryget() { var mappings = new TimeToBeReceivedMappings(new Type[] { }, TimeToBeReceivedMappings.DefaultConvention, true); TimeSpan timeToBeReceived; Assert.True(mappings.TryGetTimeToBeReceived(typeof(InheritedClassWithNoAttribute), out timeToBeReceived)); Assert.AreEqual(TimeSpan.FromSeconds(1), timeToBeReceived); }
public void Should_throw_when_discard_before_received_not_supported_when_tryget() { var mappings = new TimeToBeReceivedMappings(new Type[] { }, TimeToBeReceivedMappings.DefaultConvention, doesTransportSupportDiscardIfNotReceivedBefore: false); Assert.That(() => { return(mappings.TryGetTimeToBeReceived(typeof(InheritedClassWithNoAttribute), out _)); }, Throws.Exception.Message.StartWith("Messages with TimeToBeReceived found but the selected transport does not support this type of restriction")); }
public void Should_use_TimeToBeReceived_from_bottom_of_tree_when_initialized() { var mappings = new TimeToBeReceivedMappings(new[] { typeof(InheritedClassWithAttribute) }, TimeToBeReceivedMappings.DefaultConvention, true); TimeSpan timeToBeReceived; Assert.True(mappings.TryGetTimeToBeReceived(typeof(InheritedClassWithAttribute), out timeToBeReceived)); Assert.AreEqual(TimeSpan.FromSeconds(2), timeToBeReceived); }
public void Should_throw_when_discard_before_received_not_supported_when_tryget() { var mappings = new TimeToBeReceivedMappings(new Type[] { }, TimeToBeReceivedMappings.DefaultConvention, doesTransportSupportDiscardIfNotReceivedBefore: false); Assert.That(() => { TimeSpan ttbr; return mappings.TryGetTimeToBeReceived(typeof(InheritedClassWithNoAttribute), out ttbr); }, Throws.Exception.Message.StartWith("Messages with TimeToBeReceived found but the selected transport does not support this type of restriction")); }