Last active
November 10, 2020 20:41
-
-
Save dsibinski/10a3c47a7e997eed29fabcb07914786b to your computer and use it in GitHub Desktop.
This file contains 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
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