예제 #1
0
 public void Products()
 {
     var sut = new MruProductsImpl(new List<Guid> { products[1].Id, products[2].Id }, factories);
     var expected = new Product[] { products[1], products[2] };
     var actual = sut.Products;
     Assert.AreEqual(expected, actual);
 }
예제 #2
0
 public void ProductsNeverExceedTheCurrentMaxCount()
 {
     var initialProductIds = new List<Guid> { Guid.NewGuid(), products[1].Id, products[2].Id };
     settings.MruProductMaxCount = 1;
     var sut = new MruProductsImpl(initialProductIds, factories);
     var expected = new Product[] { products[1] };
     var actual = sut.Products;
     Assert.AreEqual(expected, actual);
     Assert.AreEqual(initialProductIds.Count, 3);
 }
예제 #3
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);
 }
예제 #4
0
 public void ProductsWhenProductDoesNotExistSkipsIt()
 {
     var sut = new MruProductsImpl(new List<Guid> { Guid.NewGuid(), products[3].Id }, factories);
     var expected = new Product[] { products[3] };
     var actual = sut.Products;
     Assert.AreEqual(expected, actual);
 }