Skip to content

Instantly share code, notes, and snippets.

@StacyGay
Created April 11, 2021 20:10
Show Gist options
  • Save StacyGay/19018f17408761b4cd7768d61c78e605 to your computer and use it in GitHub Desktop.
Save StacyGay/19018f17408761b4cd7768d61c78e605 to your computer and use it in GitHub Desktop.
Trinity of test example 1
[Theory, AutoMoqData]
public void Should_Throw_On_Invalid_Email([Frozen] Mock<IProductRepo> productRepo,
Product product, Customer customer, TransactionService testTransactionService)
{
customer.Email = "Not an email address";
productRepo.setup(repo => repo.GetProduct(It.Is<int>(product.id)).Returns(product);
Assert.Throws(() => testTransactionService.Sell(product.Id,customer));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment