コード例 #1
0
		public void should_not_add_the_same_item_twice()
		{
			var sut = new DistinctList<ShopItem>();

			var item = new ShopItem { Id = 1, Name = "Megaphone", Price = 200m };

			sut.Add(item);
			sut.Add(item);

			Assert.That(sut.Count(), Is.EqualTo(1));
		}
コード例 #2
0
        public void should_not_add_the_same_item_twice()
        {
            var sut = new DistinctList <ShopItem>();

            var item = new ShopItem {
                Id = 1, Name = "Megaphone", Price = 200m
            };

            sut.Add(item);
            sut.Add(item);

            Assert.That(sut.Count(), Is.EqualTo(1));
        }
コード例 #3
0
		public void client_test_harness()
		{
			//var basket = new SimpleList<ShopItem>();
			//var basket = new IndexedList<ShopItem>();
			var basket = new DistinctList<ShopItem>();

			var client = new Client(basket);

			var item1 = new ShopItem {Id = 1, Name = "Megaphone", Price = 200m};
			var item2 = new ShopItem {Id = 2, Name = "Trumpet", Price = 20m};
			var item3 = new ShopItem {Id = 3, Name = "Telescope", Price = 3200m};
			
			ShopItem[] purchases = {item1, item1, item1, item2, item3, item3};

			client.AddAllPurchasesToBasket(purchases);

			Assert.That(basket.Count(), Is.EqualTo(6));
		}
コード例 #4
0
        public void client_test_harness()
        {
            //var basket = new SimpleList<ShopItem>();
            //var basket = new IndexedList<ShopItem>();
            var basket = new DistinctList <ShopItem>();

            var client = new Client(basket);

            var item1 = new ShopItem {
                Id = 1, Name = "Megaphone", Price = 200m
            };
            var item2 = new ShopItem {
                Id = 2, Name = "Trumpet", Price = 20m
            };
            var item3 = new ShopItem {
                Id = 3, Name = "Telescope", Price = 3200m
            };

            ShopItem[] purchases = { item1, item1, item1, item2, item3, item3 };

            client.AddAllPurchasesToBasket(purchases);

            Assert.That(basket.Count(), Is.EqualTo(6));
        }