Example #1
0
 /// <summary>Constructs a new suffix</summary>
 /// <param name="buffer">Buffer with all added strings</param>
 /// <param name="sourceIndex">Source string index</param>
 /// <param name="sourceOffset">Offset of the source string inside the buffer</param>
 /// <param name="offset">Offset of the suffix from the sourceOffset</param>
 /// <param name="length">Length of the suffix</param>
 internal Suffix([NotNull] string buffer, int sourceIndex, int sourceOffset, int offset, int length)
 {
     DebugCode.NotNull(buffer, nameof(buffer));
     DebugCode.ValidIndex(sourceIndex, nameof(sourceIndex));
     DebugCode.ValidIndex(sourceOffset, nameof(sourceOffset), buffer.Length);
     DebugCode.ValidIndexAndCount(sourceOffset + offset, nameof(offset), length, nameof(length), buffer.Length);
     _buffer       = buffer;
     SourceIndex   = sourceIndex;
     _sourceOffset = sourceOffset;
     Offset        = offset;
     Length        = length;
 }
Example #2
0
        public void TestDebugNotNull()
        {
#if DEBUG
            var ex = Assert.Throws <ArgumentNullException>(() => DebugCode.NotNull <object>(null, "arg00"));
            Assert.That(ex.Message, Does.Contain("arg00"));
#else
            // ReSharper disable once InvocationIsSkipped
            Assert.DoesNotThrow(() => DebugCode.NotNull <object>(null, "arg00"));
#endif

            // ReSharper disable once InvocationIsSkipped
            Assert.DoesNotThrow(() => DebugCode.NotNull <object>("Hello!", "arg00"));
        }