| Previous CloneSet | Next CloneSet | Back to Main Report |
| Clone Mass | Clones in CloneSet | Parameter Count | Clone Similarity | Syntax Category [Sequence Length] |
|---|---|---|---|---|
| 47 | 2 | 2 | 0.997 | compilation_unit |
| Clone Abstraction | Parameter Bindings |
| Clone Instance (Click to see clone) | Line Count | Source Line | Source File |
|---|---|---|---|
| 1 | 47 | 1 | src/NHibernate.Test/TypesTest/DateTimeTypeFixture.cs |
| 2 | 47 | 1 | src/NHibernate.Test/TypesTest/Decima2lTypeFixture.cs |
| ||||
using System;
using NHibernate.Type;
using NUnit.Framework;
namespace NHibernate.Test.TypesTest
{
/// <summary>
/// TestFixtures for the <see cref="DateTimeType"/>.
/// </summary>
[TestFixture]
public class DateTimeTypeFixture
{
[Test]
public void Next()
{
DateTimeType type = (DateTimeType) NHibernateUtil.DateTime;
object current = DateTime.Parse("2004-01-01");
object next = type.Next(current, null);
Assert.IsTrue(next is DateTime, "Next should be DateTime");
Assert.IsTrue((DateTime) next > (DateTime) current,
"next should be greater than current (could be equal depending on how quickly this occurs)");
}
[Test]
public void Seed()
{
DateTimeType type = (DateTimeType) NHibernateUtil.DateTime;
Assert.IsTrue(type.Seed(null) is DateTime, "seed should be DateTime");
}
[Test]
public void DeepCopyNotNull()
{
NullableType type = NHibernateUtil.DateTime;
object value1 = DateTime.Now;
object value2 = type.DeepCopy(value1, EntityMode.Poco, null);
Assert.AreEqual(value1, value2, "Copies should be the same.");
value2 = ((DateTime)value2).AddHours(2);
Assert.IsFalse(value1 == value2, "value2 was changed, value1 should not have changed also.");
}
}
}
|
| ||||
using System;
using NHibernate.Type;
using NUnit.Framework;
namespace NHibernate.Test.TypesTest
{
/// <summary>
/// TestFixtures for the <see cref="DateTimeType"/>.
/// </summary>
[TestFixture]
public class DateTime2TypeFixture
{
[Test]
public void Next()
{
DateTimeType type = (DateTimeType)NHibernateUtil.DateTime2;
object current = DateTime.Parse("2004-01-01");
object next = type.Next(current, null);
Assert.IsTrue(next is DateTime, "Next should be DateTime");
Assert.IsTrue((DateTime)next > (DateTime)current,
"next should be greater than current (could be equal depending on how quickly this occurs)");
}
[Test]
public void Seed()
{
DateTimeType type = (DateTimeType)NHibernateUtil.DateTime;
Assert.IsTrue(type.Seed(null) is DateTime, "seed should be DateTime");
}
[Test]
public void DeepCopyNotNull()
{
NullableType type = NHibernateUtil.DateTime;
object value1 = DateTime.Now;
object value2 = type.DeepCopy(value1, EntityMode.Poco, null);
Assert.AreEqual(value1, value2, "Copies should be the same.");
value2 = ((DateTime)value2).AddHours(2);
Assert.IsFalse(value1 == value2, "value2 was changed, value1 should not have changed also.");
}
}
}
|
| |||
using System;
using NHibernate.Type;
using NUnit.Framework;
namespace NHibernate.Test.TypesTest
{
/// <summary>
/// TestFixtures for the <see cref="DateTimeType"/>.
/// </summary>
[TestFixture]
public class [[#variable583c5120]]
{
[Test]
public void Next()
{
DateTimeType type = (DateTimeType)NHibernateUtil. [[#variable583c50c0]];
object current = DateTime.Parse("2004-01-01");
object next = type.Next(current, null);
Assert.IsTrue(next is DateTime, "Next should be DateTime");
Assert.IsTrue((DateTime)next > (DateTime)current, "next should be greater than current (could be equal depending on how quickly this occurs)");
}
[Test]
public void Seed()
{
DateTimeType type = (DateTimeType)NHibernateUtil.DateTime;
Assert.IsTrue(type.Seed(null) is DateTime, "seed should be DateTime");
}
[Test]
public void DeepCopyNotNull()
{
NullableType type = NHibernateUtil.DateTime;
object value1 = DateTime.Now;
object value2 = type.DeepCopy(value1, EntityMode.Poco, null);
Assert.AreEqual(value1, value2, "Copies should be the same.");
value2 = ((DateTime)value2).AddHours(2);
Assert.IsFalse(value1 == value2, "value2 was changed, value1 should not have changed also.");
}
}
}
|
| CloneAbstraction |
| Parameter Index | Clone Instance | Parameter Name | Value |
|---|---|---|---|
| 1 | 1 | [[#583c5120]] | DateTimeTypeFixture |
| 1 | 2 | [[#583c5120]] | DateTime2TypeFixture |
| 2 | 1 | [[#583c50c0]] | DateTime |
| 2 | 2 | [[#583c50c0]] | DateTime2 |