Created
March 26, 2011 08:51
-
-
Save HEskandari/888143 to your computer and use it in GitHub Desktop.
Testing Saving of Decimal/Double Values
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Test] | |
public void Decimal_Values_Are_Not_Truncated_Once_Saved() | |
{ | |
var entity = new DecimalEntity | |
{ | |
SimpleDecimal = 1.1m, | |
SimpleDouble = 1.2d, | |
NullableDecimal = 1.3m, | |
NullableDouble = 1.4d | |
}; | |
var session = SessionFactory.OpenSession(); | |
session.Save(entity); | |
session.Flush(); | |
session.Clear(); | |
var readback = session.CreateCriteria(typeof(DecimalEntity)) | |
.Add(Restrictions.Eq("Id", entity.Id)) | |
.UniqueResult(); | |
Assert.IsNotNull(entity); | |
Assert.AreEqual((decimal)1.1, entity.SimpleDecimal); | |
Assert.AreEqual(1.2, entity.SimpleDouble); | |
Assert.AreEqual((decimal?)1.3, entity.NullableDecimal); | |
Assert.AreEqual(1.4, entity.NullableDouble); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment