public void Collapse_CollapsesLeadingWhitespace(string dummyLine, float dummyCollapseLength, string expectedResult) { // Arrange var testSubject = new LeadingWhitespaceEditorService(); var dummyStringSlice = new StringSlice(dummyLine); // Act testSubject.Collapse(ref dummyStringSlice, dummyCollapseLength); // Assert Assert.Equal(expectedResult, dummyStringSlice.ToString()); }
public void Collapse_ThrowsArgumentOutOfRangeExceptionIfCollapseRatioIsNotWithinTheAcceptedRange(float dummyCollapseRatio) { // Arrange var testSubject = new LeadingWhitespaceEditorService(); var dummyStringSlice = new StringSlice(); // Act and assert ArgumentOutOfRangeException result = Assert.Throws <ArgumentOutOfRangeException>(() => testSubject.Collapse(ref dummyStringSlice, dummyCollapseRatio)); Assert.Equal(string.Format(Strings.ArgumentOutOfRangeException_Shared_ValueMustBeWithinRange, "[0, 1]", dummyCollapseRatio) + "\nParameter name: collapseRatio", result.Message, ignoreLineEndingDifferences: true); }