Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

BigDecimal type now has a couple tests, however more would be appreci…

…ated.
  • Loading branch information...
commit 3dfff717c6cd12d1b6ac38d08e60076254251e62 1 parent 65b3728
@nberardi nberardi authored
Showing with 68 additions and 0 deletions.
  1. +68 −0 test/FluentCassandra.Tests/BigDecimalTest.cs
View
68 test/FluentCassandra.Tests/BigDecimalTest.cs
@@ -0,0 +1,68 @@
+using System;
+using System.Linq;
+using System.Numerics;
+using Xunit;
+
+namespace FluentCassandra
+{
+ public class BigDecimalTest
+ {
+ [Fact]
+ public void Decimal_Same_In_And_Out()
+ {
+ // arrange
+ var expected = 1000000.00013M;
+
+ // act
+ var bigDec = new BigDecimal(expected);
+ var actual = (decimal)bigDec;
+
+ // assert
+ Assert.Equal(expected, actual);
+ }
+
+ [Fact]
+ public void Negative_Decimal_Same_In_And_Out()
+ {
+ // arrange
+ var expected = -1000000.00013M;
+
+ // act
+ var bigDec = new BigDecimal(expected);
+ var actual = (decimal)bigDec;
+
+ // assert
+ Assert.Equal(expected, actual);
+ }
+
+ [Fact]
+ public void ToString()
+ {
+ // arrange
+ var dec = 1000000.00013M;
+ var expected = dec.ToString("G");
+
+ // act
+ var bigDec = new BigDecimal(dec);
+ var actual = bigDec.ToString();
+
+ // assert
+ Assert.Equal(expected, actual);
+ }
+
+ [Fact]
+ public void Negative_ToString()
+ {
+ // arrange
+ var dec = -1000000.00013M;
+ var expected = dec.ToString("G");
+
+ // act
+ var bigDec = new BigDecimal(dec);
+ var actual = bigDec.ToString();
+
+ // assert
+ Assert.Equal(expected, actual);
+ }
+ }
+}
Please sign in to comment.
Something went wrong with that request. Please try again.