static void Main(string[] args) { Listify listify = new Listify(100, 200); var val = listify[50]; Assert.AreEqual(val, 150); }
public IActionResult example() { // Given a list of numbers ranging from 100 to 200 var list = new Listify(100, 200); var ab = list[50]; var isEqual = ab.Should().Equal(150); var ch = list.Max();//just to show you have access to all IEnumerable methods return(Json(new { IsEqual = isEqual, Value = ab })); }
public void VerifyContainsAllValues() { //Given the following values var minValue = 0; var maxValue = 10; //When I create the listify instance along with a compareable Enumerable.Range() var list = new Listify(minValue, maxValue); var expectedValues = Enumerable.Range(minValue, maxValue); //Then they should be equal Assert.True(list.SequenceEqual(expectedValues)); }
public void ContainValue(int value, bool shouldContain) { //Given the following values var minValue = 10; var maxValue = 100; var list = new Listify(minValue, maxValue); //When I get whether it contains the value var containsValue = list.Contains(value); //Then it should match shouldContain Assert.Equal(shouldContain, containsValue); }
public void CountShouldMatchCountValue() { //Given the following values var minValue = 10; var maxValue = 100; var list = new Listify(minValue, maxValue); //When I get the Count var count = list.Count; //Then the count should match the expected value Assert.Equal(maxValue - minValue, count); }
public void IndexValueThrowsIndexOutOfRangeException() { //Given the following values var minValue = 10; var maxValue = 100; var index = 2000; var list = new Listify(minValue, maxValue); //When I access the index position var lazyListifyIndex = new Lazy <Listify>(list); //Then the index call should throw an ArgumentOutOfRangeException Assert.Throws <IndexOutOfRangeException>(() => lazyListifyIndex.Value[index]); }
public void IndexValueMatchesExpectedValue() { //Given the following values var minValue = 10; var maxValue = 100; var index = 10; var list = new Listify(minValue, maxValue); //When I access the index position var value = list[index]; //Then I should get back the value of the index position Assert.Equal(minValue + index, value); }