summaryrefslogtreecommitdiff
path: root/spec/unit/utility/NumericConversionsSpecs.cs
blob: 0f80a6819f091f41529aab0c7ccbf0e1edba0a46 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
using jive.utility;
using Machine.Specifications;

namespace specs.unit.utility
{
  [Subject(typeof (NumericConversions))]
  public class when_converting_a_valid_string_to_a_long
  {
    It should_return_the_correct_result = () => result.should_be_equal_to(88L);

    Establish c = () => { valid_numeric_string = "88"; };

    Because b = () => { result = valid_numeric_string.to_long(); };

    static long result;
    static string valid_numeric_string;
  }

  [Subject(typeof (NumericConversions))]
  public class when_converting_a_valid_string_to_an_int 
  {
    It should_return_the_correct_result = () => result.should_be_equal_to(66);

    Establish c = () => { valid_numeric_string = "66"; };

    Because b = () => { result = valid_numeric_string.to_int(); };

    static int result;
    static string valid_numeric_string;
  }
}