public void Sort_ShouldSortCorrectlyWithProvidedEqualityComparer() { // Arange CustomList <SampleReferenceType> list = new CustomList <SampleReferenceType>() { new SampleReferenceType("aaa", 2), new SampleReferenceType("aaaa", 1), new SampleReferenceType("bbbb", 3), new SampleReferenceType("aaaa", 3) }; SampleReferenceType[] expected = new SampleReferenceType[] { list[1], list[0], list[3], list[2], }; // Act list.Sort(Comparer <SampleReferenceType> .Create((x, y) => { if (x.Id - y.Id != 0) { return(x.Id - y.Id); } else { return (x.Name.CompareTo(y.Name)); } })); // Assert for (int i = 0; i < expected.Length; i++) { Assert.Equal(expected[i], list[i]); } }
public void AssignNull(SampleReferenceType argument) { argument = null; }
public void ChangeProperty(SampleReferenceType argument) { argument.Greeting = "Changed"; }
public void ChangePropertyRef(ref SampleReferenceType argumentRef) { argumentRef.Greeting = "Changed"; }
public void AssignNullRef(ref SampleReferenceType argumentRef) { argumentRef = null; }