Advertisement
Guest User

Is there a fluent assertion API for MSTest

a guest
Feb 28th, 2012
32
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. "ABCDEFGHI".Should().StartWith("AB").And.EndWith("HI").And.Contain("EF").And.HaveLength(9);
  2.  
  3. new[] { 1, 2, 3 }.Should().HaveCount(4, "because we thought we put three items in the
  4. collection"))
  5.  
  6. dtoCollection.Should().Contain(dto => dto.Id != null);
  7.  
  8. collection.Should().HaveCount(c => c >= 3);
  9.  
  10. dto.ShouldHave().AllPropertiesBut(d => d.Id).EqualTo(customer);
  11.  
  12. dt1.Should().BeWithin(TimeSpan.FromHours(50)).Before(dt2);
  13.  
  14. Action action = () => recipe.AddIngredient("Milk", 100, Unit.Spoon);
  15. action
  16. .ShouldThrow<RuleViolationException>()
  17. .WithMessage("Cannot change the unit of an existing ingredient")
  18. .And.Violations.Should().Contain(BusinessRule.CannotChangeIngredientQuanity
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement