Ejemplo n.º 1
0
 public void AddProduct()
 {
     var sut = new MruProductsImpl(new List<Guid> { products[0].Id }, factories);
     sut.AddProduct(products[1]);
     var expected = new Product[] { products[1], products[0] };
     var actual = sut.Products;
     Assert.AreEqual(expected, actual);
 }
Ejemplo n.º 2
0
 public void AddProductWhenAlreadyHasMaxCountAndAddedNewProduct()
 {
     var initialProductIds = products.Take(settings.MruProductMaxCount).Select(product => product.Id).ToList();
     var sut = new MruProductsImpl(initialProductIds, factories);
     sut.AddProduct(products[settings.MruProductMaxCount]);
     var expected = products.Take(settings.MruProductMaxCount - 1).ToList();
     expected.Insert(0, products[settings.MruProductMaxCount]);
     var actual = sut.Products;
     Assert.AreEqual(expected, actual);
     Assert.AreEqual(expected.Select(item => item.Id), initialProductIds);
 }