public void IList_Generic_IndexOf_ValidValueNotContainedInList(int count) { SCG.IList <T> list = GenericIListFactory(count); int seed = 54321; T value = CreateT(seed++); while (list.Contains(value)) { value = CreateT(seed++); } Assert.Equal(-1, list.IndexOf(value)); }
public void IList_Generic_IndexOf_DefaultValueContainedInList(int count) { if (count > 0 && DefaultValueAllowed) { SCG.IList <T> list = GenericIListFactory(count); T value = default(T); if (!list.Contains(value)) { if (IsReadOnly) { return; } list[0] = value; } Assert.Equal(0, list.IndexOf(value)); } }
public void IList_Generic_IndexOf_DefaultValueNotContainedInList(int count) { if (DefaultValueAllowed) { SCG.IList <T> list = GenericIListFactory(count); T value = default(T); if (list.Contains(value)) { if (IsReadOnly) { return; } list.Remove(value); } Assert.Equal(-1, list.IndexOf(value)); } else { SCG.IList <T> list = GenericIListFactory(count); Assert.Throws <ArgumentNullException>(() => list.IndexOf(default(T))); } }