Created
June 19, 2017 19:55
-
-
Save yaplex/664193275f04824ac99620a889aaf173 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[TestFixture] | |
public class ProductBLTests | |
{ | |
[Test] | |
public void GetProductsTest() | |
{ | |
MockRepository mocks = new MockRepository(); | |
ProductDAL dal = (ProductDAL)mocks.StrictMock(typeof(ProductDAL)); | |
using (mocks.Record()) | |
{ | |
List<Product> expectedProducts = new List<Product>(); | |
Product p = new Product(); | |
p.Name = "Dell Pc"; | |
p.Id = 333; | |
expectedProducts.Add(p); | |
Expect.Call(dal.GetProducts()).Return(expectedProducts); | |
} | |
using (mocks.Playback()) | |
{ | |
ProductBL bl = new ProductBL(dal); | |
List<Product> products = bl.GetProducts(); | |
Assert.AreEqual(1, products.Count); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment