Copied the Constructor Tests
This commit is contained in:
parent
7e70235831
commit
aad560b4fc
1 changed files with 32 additions and 0 deletions
|
|
@ -2,5 +2,37 @@
|
||||||
|
|
||||||
public class FlexArrayStringTests
|
public class FlexArrayStringTests
|
||||||
{
|
{
|
||||||
|
[Fact]
|
||||||
|
public void Construction_NoSize()
|
||||||
|
{
|
||||||
|
var array = new FlexArrayString();
|
||||||
|
|
||||||
|
array.Should().NotBeNull();
|
||||||
|
array.Count.Should().Be(0, "no items added yet");
|
||||||
|
array.Capacity.Should().Be(FlexArrayString.DefaultStartSize, "default capacity");
|
||||||
|
}
|
||||||
|
|
||||||
|
[Theory]
|
||||||
|
[InlineData(0)]
|
||||||
|
[InlineData(4)]
|
||||||
|
[InlineData(20)]
|
||||||
|
[InlineData(100_000)]
|
||||||
|
public void Construction_WithSize(int size)
|
||||||
|
{
|
||||||
|
var array = new FlexArrayString(size);
|
||||||
|
|
||||||
|
array.Should().NotBeNull();
|
||||||
|
array.Count.Should().Be(0, "no items added yet");
|
||||||
|
array.Capacity.Should().Be(size, "initial capacity set to specified size");
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void Construction_WithInvalidSize()
|
||||||
|
{
|
||||||
|
var array = new FlexArrayString(-5);
|
||||||
|
|
||||||
|
array.Should().NotBeNull();
|
||||||
|
array.Count.Should().Be(0);
|
||||||
|
array.Capacity.Should().Be(0, "negative size provided => set to 0");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue