public void ByCharacteristic_PoolKey_ShouldBeSame(int?capacity, int?maxCapacity, string poolKey) { using (var test = new Perf.PoolBoy <Txt.StringBuilder>()) { var stringBuilder = new Perf.Text.StringBuilder(capacity, maxCapacity, poolKey); stringBuilder.Append("I want to test this out."); stringBuilder.Dispose(DONOTCLEAR); test.ResetItemCounter(); var stringBuilder2 = new Perf.Text.StringBuilder(capacity, maxCapacity, poolKey); stringBuilder2.performanceObject.Should().BeSameAs(stringBuilder.performanceObject); stringBuilder2.ToString().Should().Be(stringBuilder.ToString()); } }
[InlineData(101, 100)] // Cap, no max public void ByCharacteristic_PoolKey_ShouldBeSame(int?capacity, int appends) { var contents = "0123456789"; using (var test = new Perf.PoolBoy <System.Collections.Generic.List <string> >()) { var list = capacity.HasValue ? new Perf.Collection.Generic.List <string>(capacity.Value) : new Perf.Collection.Generic.List <string>(0); for (var i = 0; i < appends; i++) { list.Add(contents); } list.Dispose(DONOTCLEAR); test.ResetItemCounter(); var list2 = capacity.HasValue ? new Perf.Collection.Generic.List <string>(capacity.Value) : new Perf.Collection.Generic.List <string>(); list2.performanceObject.Should().BeSameAs(list.performanceObject); list2.ToString().Should().Be(list.ToString()); } }