Pastebin launched a little side project called VERYVIRAL.com, check it out ;-) Want more features on Pastebin? Sign Up, it's FREE!
Guest

Is there a fluent assertion API for MSTest

By: a guest on Feb 28th, 2012  |  syntax: None  |  size: 0.67 KB  |  views: 15  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  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