コード例 #1
0
 public void ConvertsWordsToNegativeNumbers()
 {
     Assert.Equal(-900013, WordToNumberConverter.Convert("negative nine hundred thousand thirteen"));
     Assert.Equal(-18476, WordToNumberConverter.Convert("negative eighteen thousand four hundred seventy six"));
     Assert.Equal(-1345678919, WordToNumberConverter.Convert("negative one billion three hundred fourty five million six hundred seventy eight thousand nine hundred nineteen"));
     Assert.Equal(-1, WordToNumberConverter.Convert("negative one"));
     Assert.Equal(-36, WordToNumberConverter.Convert("negative thirty six"));
 }
コード例 #2
0
 public void ConvertsWordsToPositiveNumbers()
 {
     Assert.Equal(900013, WordToNumberConverter.Convert("nine hundred thousand thirteen"));
     Assert.Equal(18476, WordToNumberConverter.Convert("eighteen thousand four hundred seventy six"));
     Assert.Equal(1345678919, WordToNumberConverter.Convert("one billion three hundred fourty five million six hundred seventy eight thousand nine hundred nineteen"));
     Assert.Equal(1, WordToNumberConverter.Convert("one"));
     Assert.Equal(36, WordToNumberConverter.Convert("thirty six"));
 }
コード例 #3
0
 public void DealsWithImproperInputs()
 {
     Assert.Equal(0, WordToNumberConverter.Convert(null));
     Assert.Equal(0, WordToNumberConverter.Convert(""));
 }
コード例 #4
0
 public void ConvertsZeroes()
 {
     Assert.Equal("zero", NumberToWordConverter.Convert(0));
     Assert.Equal(0, WordToNumberConverter.Convert("zero"));
 }