/source/test/NOS.Registration.Tests/UserDataSpecs.cs

http://github.com/agross/netopenspace · C# · 50 lines · 37 code · 13 blank · 0 comment · 0 complexity · 45576104c369ecc7de37a2a49f07784e MD5 · raw file

  1. using Machine.Specifications;
  2. namespace NOS.Registration.Tests
  3. {
  4. [Subject(typeof(UserData))]
  5. public class When_the_formatted_sponsoring_for_zero_euros_is_created : With_user
  6. {
  7. Because of = () => { Formatted = User.FormattedSponsoring; };
  8. It should_return_an_empty_string = () => Formatted.ShouldBeEmpty();
  9. }
  10. [Subject(typeof(UserData))]
  11. public class When_the_formatted_sponsoring_for_integer_euros_is_created : With_user
  12. {
  13. Establish context = () => { User.Sponsoring = 42; };
  14. Because of = () => { Formatted = User.FormattedSponsoring; };
  15. It should_return_the_integer_part = () => Formatted.ShouldEqual("42");
  16. }
  17. [Subject(typeof(UserData))]
  18. public class When_the_formatted_sponsoring_for_fractional_euros_is_created : With_user
  19. {
  20. Establish context = () => { User.Sponsoring = 0.1m; };
  21. Because of = () => { Formatted = User.FormattedSponsoring; };
  22. It should_return_the_fractional_part_padded_with_zero = () => Formatted.ShouldEqual("0,10");
  23. }
  24. [Subject(typeof(UserData))]
  25. public class When_the_formatted_sponsoring_for_fractional_euros_larger_than_one_is_created : With_user
  26. {
  27. Establish context = () => { User.Sponsoring = 42.1m; };
  28. Because of = () => { Formatted = User.FormattedSponsoring; };
  29. It should_return_the_fractional_part_padded_with_zero = () => Formatted.ShouldEqual("42,10");
  30. }
  31. public class With_user
  32. {
  33. protected static string Formatted;
  34. protected static UserData User;
  35. Establish context = () => { User = new UserData { Sponsoring = 0 }; };
  36. }
  37. }