本文整理汇总了C#中FakeRepository.FindAll方法的典型用法代码示例。如果您正苦于以下问题:C# FakeRepository.FindAll方法的具体用法?C# FakeRepository.FindAll怎么用?C# FakeRepository.FindAll使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FakeRepository
的用法示例。
在下文中一共展示了FakeRepository.FindAll方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: FakeProductProductRepository_Delete_RemovesProductIfPresent
public void FakeProductProductRepository_Delete_RemovesProductIfPresent()
{
// Arrange
var product = ObjectMother.Test2Product;
IRepository<Product> repo = new FakeRepository<Product>(ObjectMother.Test1Product,
product);
// Act
repo.Delete(product);
// Assert
Assert.AreEqual<int>(1, repo.FindAll().Count());
Assert.IsNull(repo.FindAll().Where(p => p.ID == product.ID).FirstOrDefault());
}
示例2: FakeProductProductRepository_FindAll_ReturnsListOfProductWithCorrectLength
public void FakeProductProductRepository_FindAll_ReturnsListOfProductWithCorrectLength()
{
// Arrange
IRepository<Product> repo = new FakeRepository<Product>(ObjectMother.Test1Product);
// Act
var products = repo.FindAll();
// Assert
Assert.AreEqual(1, products.Count());
}
示例3: FakeProductProductRepository_FindAll_ReturnsListOfProduct
public void FakeProductProductRepository_FindAll_ReturnsListOfProduct()
{
// Arrange
IRepository<Product> repo = new FakeRepository<Product>(ObjectMother.Test1Product);
// Act
var products = repo.FindAll();
// Assert
Assert.AreEqual(1, products.Count());
Assert.AreEqual(products.FirstOrDefault().GetType(), typeof(Product));
}
示例4: FakeProductProductRepository_Delete_RemovesNoProductIfNotPresent
public void FakeProductProductRepository_Delete_RemovesNoProductIfNotPresent()
{
// Arrange
IRepository<Product> repo = new FakeRepository<Product>(ObjectMother.Test1Product);
int newID = 2;
var product = new Product { ID = newID, Name = "Test2" };
// Act
repo.Delete(product);
// Assert
Assert.AreEqual<int>(1, repo.FindAll().Count());
}
示例5: FakeProductProductRepository_Save_AddsProductIfNotPresent
public void FakeProductProductRepository_Save_AddsProductIfNotPresent()
{
// Arrange
IRepository<Product> repo = new FakeRepository<Product>(ObjectMother.Test1Product);
int newID = 2;
var product = new Product { ID = newID, Name = "Test2" };
// Act
repo.Save(product);
// Assert
Assert.AreEqual<int>(2, repo.FindAll().Count());
Assert.IsNotNull(repo.FindAll().Where(p => p.ID == newID).FirstOrDefault());
}