コード例 #1
0
        public void FromEntityList_should_map_properties_when_entity_list_contains_entities()
        {
            var productEntityList = Fakes.FakeProductList();

            var productList = new ProductListItem().FromEntityList(productEntityList);

            Assert.That(productList, Is.Not.Null);
            Assert.That(productList.Any(), Is.True);
            Assert.That(productList[0].Name, Is.EqualTo(productEntityList.ToList()[0].Name));
        }
コード例 #2
0
        public void List_should_invoke_List_on_ProductService()
        {
            var fakeReturn = new Tuple <IEnumerable <Product>, int>(Fakes.FakeProductList(), 10);

            service.Setup(x => x.List(It.IsAny <ProductListSearchCriteria>())).Returns(fakeReturn).Verifiable();

            var action = controller.List(0, 0, string.Empty);
            var model  = (List <ProductListItem>)action.ViewData.Model;

            Assert.That(action, Is.Not.Null);
            Assert.That(model, Is.Not.Null);
            Assert.That(model[0].Name, Is.EqualTo("Product0"));
            Assert.That(model.Count, Is.EqualTo(10));
            service.Verify(x => x.List(It.IsAny <ProductListSearchCriteria>()), Times.AtMostOnce());
        }