public void Lead_WithTestCases_ProducesCorrectResults(string collectionString, int amount, string expectedString) { int[] collection = collectionString.Split(',').Where(s => !string.IsNullOrWhiteSpace(s)).Select(int.Parse).ToArray(); var output = CollectionExtensions.Lead(collection, amount); var outputString = string.Join(",", output.Select(item => $"({item.Element},{item.LeadingElement})")); Assert.That(outputString, Is.EqualTo(expectedString)); }
public void Lead_NullCollection_ThrowsArgumentNullException() { IEnumerable <int> collection = null; Assert.Throws <ArgumentNullException>(() => CollectionExtensions.Lead(collection)); }
public void Lead_NegativeAmount_ThrowsArgumentOutOfRangeException() { IEnumerable <int> collection = Enumerable.Range(0, 10); Assert.Throws <ArgumentOutOfRangeException>(() => CollectionExtensions.Lead(collection, -1)); }