public void IsInt_WhenIsCorrectType_It_should_not_throw() => ShouldNotThrow( () => Ensure.Type.IsInt(typeof(int), ParamName), () => Ensure.Type.IsInt(42, ParamName), () => EnsureArg.IsInt(typeof(int), ParamName), () => EnsureArg.IsInt(42, ParamName), () => Ensure.ThatType(typeof(int), ParamName).IsInt(), () => Ensure.ThatTypeFor(42, ParamName).IsInt());
public void IsInt_WhenNotTypeOf_ThrowsArgumentException() => AssertIsOfTypeScenario( typeof(int), typeof(decimal), () => Ensure.Type.IsInt(typeof(decimal), ParamName), () => Ensure.Type.IsInt(42m, ParamName), () => EnsureArg.IsInt(typeof(decimal), ParamName), () => EnsureArg.IsInt(42m, ParamName), () => Ensure.ThatType(typeof(decimal), ParamName).IsInt(), () => Ensure.ThatTypeFor(42m, ParamName).IsInt());
public EventBatchingService(IEventConsumerService eventConsumerService, EventBatchingOptions options, ICheckpointClient checkpointClient, ITelemetryLogger logger) { EnsureArg.IsNotNull(options); EnsureArg.IsInt(options.MaxEvents); EnsureArg.IsInt(options.FlushTimespan); _eventPartitions = new ConcurrentDictionary <string, EventPartition>(); _eventConsumerService = eventConsumerService; _maxEvents = options.MaxEvents; _flushTimespan = TimeSpan.FromSeconds(options.FlushTimespan); _checkpointClient = checkpointClient; _logger = logger; }
public void IsInt_WhenIsCorrectType_It_should_not_throw() { var returnedValue = Ensure.ThatTypeFor(42, ParamName).IsInt(); AssertReturnedAsExpected(returnedValue, typeof(int)); Action a = () => EnsureArg.IsInt(typeof(int), ParamName); a.ShouldNotThrow(); Action b = () => EnsureArg.IsInt(42, ParamName); b.ShouldNotThrow(); }