public void GivenTwoScannersOnSameStream_ShouldBuildConsistendList() { _testee.MonitorEvents(); _testeeAfterwards.MonitorEvents(); _testee.ItemDetected(new TestItem(5)); _testee.ItemDetected(new TestItem(4)); _testeeAfterwards.ItemDetected(new TestItem(5)); _testeeAfterwards.ItemDetected(new TestItem(4)); _testee.ItemDetected(new TestItem(3)); _testeeAfterwards.ItemDetected(new TestItem(3)); _testee.ItemDetected(new TestItem(2)); _testee.ItemDetected(new TestItem(1)); _testeeAfterwards.ItemDetected(new TestItem(2)); _testeeAfterwards.ItemDetected(new TestItem(1)); _testee.ShouldNotRaise("ItemRemovedEvent"); _testeeAfterwards.ShouldNotRaise("ItemRemovedEvent"); var list1 = _testee.GetOrderedList(); var list2 = _testeeAfterwards.GetOrderedList(); list1.Count.Should().Be(5); list2.Count.Should().Be(5); list1[0].Should().Be(new TestItem(5)); list1[4].Should().Be(new TestItem(1)); list2[0].Should().Be(new TestItem(5)); list2[4].Should().Be(new TestItem(1)); list1[3].ItemInFront.Should().Be(list1[2]); list1[2].ItemBehind.Should().Be(list1[3]); }
public void WhenDetectItems_ShouldBeInTheList_ButOnlyOne() { var item = new TestItem(1); _testee.ItemDetected(item); _testee.Items.Should().ContainKey(item); _testee.ItemDetected(item); _testee.Items.Should().ContainKey(item); _testee.Items.Should().HaveCount(1, "same item was detected twice"); _testee.GetOrderedList().Should().Contain(item); _testee.GetOrderedList().Should().HaveCount(1); _testee.Contains(item).Should().BeTrue(); }