コード例 #1
0
 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());
コード例 #2
0
 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());
コード例 #3
0
        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;
        }
コード例 #4
0
        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();
        }