PageRenderTime 104ms CodeModel.GetById 99ms app.highlight 3ms RepoModel.GetById 1ms app.codeStats 0ms

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