Skip to content

Instantly share code, notes, and snippets.

@dsibinski
Last active November 10, 2020 20:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dsibinski/10a3c47a7e997eed29fabcb07914786b to your computer and use it in GitHub Desktop.
Save dsibinski/10a3c47a7e997eed29fabcb07914786b to your computer and use it in GitHub Desktop.
class ProductAssert
{
private readonly Product _product;
public ProductAssert(Product product)
{
_product = product;
}
public ProductAssert HaveDiscount(string name, int value)
{
_product.Discount.Should().NotBeNull();
_product.Discount.Name.Should().Be(name);
_product.Discount.PercentageValue.Should().Be(value);
_product.BasePrice.Should().NotBe(_product.SalesPrice);
return this;
}
public ProductAssert BeAvailable()
{
_product.IsAvailable.Should().BeTrue();
return this;
}
public ProductAssert Cost(decimal price)
{
_product.SalesPrice.Should().Be(80);
return this;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment