Telerik JustMock
[TestMethod]
public
void
Test_ExecutionOfAddProduct_OccursOnce()
{
// Arrange
Order order = Mock.Create<Order>(Behavior.CallOriginal);
Mock.Arrange(() => order.AddProduct(Arg.IsAny<Product>(), Arg.AnyInt)).OccursOnce();
// Action
Product product =
new
Product(
"socks"
);
order.AddProduct(product, 2);
// Assert
Mock.Assert(order);
}
[TestMethod]
public
void
Test_ExecutionOfAddProduct_OccursOnce()
{
// Arrange
Order order = Mock.Create<Order>(Behavior.CallOriginal);
// Action
Product product =
new
Product(
"socks"
);
order.AddProduct(product, 2);
// Assert
Mock.Assert(() => order.AddProduct(product, 2), Occurs.Once());
}