[Test] public void RemoveDuplicateTest() { var l = new RandomList <int> { 1, 2, 2, 3, 4 }; Assert.AreEqual(true, l.Remove(2)); Assert.AreEqual(F.list(1, 4, 2, 3), l); Assert.AreEqual(4, l.Count); Assert.AreEqual(true, l.Remove(2)); Assert.AreEqual(F.list(1, 4, 3), l); Assert.AreEqual(3, l.Count); }
[Test] public void RemoveNonExistingTest() { var l = new RandomList <int> { 1, 2, 3, 4 }; Assert.AreEqual(false, l.Remove(5)); Assert.AreEqual(F.list(1, 2, 3, 4), l); Assert.AreEqual(4, l.Count); }
[Test] public void RemoveFromEndTest() { var l = new RandomList <int> { 1, 2, 3, 4 }; Assert.AreEqual(true, l.Remove(4)); Assert.AreEqual(F.list(1, 2, 3), l); Assert.AreEqual(3, l.Count); }
public string RandomString(RandomList rndList) { Random rnd = new Random(); int randomIndex = rnd.Next(0, rndList.Count); string str = rndList[randomIndex]; rndList.Remove(str); return(str); }
public Coroutine after(Duration duration, Action act, string name) { TestTimeContextCoroutine cr = null; // ReSharper disable once PossibleNullReferenceException var entry = F.t(timePassed + duration, (Action)(() => cr.timeHit()), name); cr = new TestTimeContextCoroutine(() => actions.Remove(entry)); cr.onFinish += act; actions.Add(entry); return(cr); }
public void Removing_NonExistentItem() { // Arrange var randList = new RandomList <int> { 1, 2, 3 }; // Act bool resutl = randList.Remove(5); // Assert Assert.False(resutl); }
public List <T> GetRandomItems(int count) { List <T> result = new List <T>(); var tl = new RandomList <T>(this); for (int i = 0; i < count; i++) { if (tl.Count <= 0) { break; } var t = tl.GetRandomItem(); result.Add(t); tl.Remove(t); tl.TotalValue = 0; } return(result); }
public void RemovingItems(int itemsCount) { // Arrange var randList = new RandomList <int>(); for (int i = 0; i < itemsCount; i++) { randList.Add(i); } // Act for (int i = 0; i < itemsCount; i++) { randList.Remove(i); } // Assert Assert.True(0 == randList.Count); }