| Previous CloneSet | Next CloneSet | Back to Main Report |
| Clone Mass | Clones in CloneSet | Parameter Count | Clone Similarity | Syntax Category [Sequence Length] |
|---|---|---|---|---|
| 12 | 4 | 3 | 0.976 | class_member_declaration |
| Clone Abstraction | Parameter Bindings |
| Clone Instance (Click to see clone) | Line Count | Source Line | Source File |
|---|---|---|---|
| 1 | 12 | 45 | src/NHibernate.Test/NHSpecificTest/NH1393/Fixture.cs |
| 2 | 12 | 60 | src/NHibernate.Test/NHSpecificTest/NH1393/Fixture.cs |
| 3 | 12 | 75 | src/NHibernate.Test/NHSpecificTest/NH1393/Fixture.cs |
| 4 | 12 | 90 | src/NHibernate.Test/NHSpecificTest/NH1393/Fixture.cs |
| ||||
[Test]
public void CanSumProjectionOnSqlFunction()
{
using (ISession s = OpenSession())
{
ISQLFunction arithmaticAddition = new VarArgsSQLFunction("(", "+", ")");
ICriteria c =
s.CreateCriteria( typeof( Person)).SetProjection(
Projections.Sum(Projections.SqlFunction(arithmaticAddition, NHibernateUtil.GuessType( typeof( double)),
Projections.Property("IQ"), Projections.Property("ShoeSize"))));
IList list = c.List();
Assert.AreEqual(334, list[0]);
}
}
|
| ||||
[Test]
public void CanAvgProjectionOnSqlFunction()
{
using (ISession s = OpenSession())
{
ISQLFunction arithmaticAddition = new VarArgsSQLFunction("(", "+", ")");
ICriteria c =
s.CreateCriteria( typeof( Person)).SetProjection(
Projections.Avg(Projections.SqlFunction(arithmaticAddition, NHibernateUtil.GuessType( typeof( double)),
Projections.Property("IQ"), Projections.Property("ShoeSize"))));
IList list = c.List();
Assert.AreEqual(((double) 334) / 5, list[0]);
}
}
|
| ||||
[Test]
public void CanMinProjectionOnIdentityProjection()
{
using (ISession s = OpenSession())
{
ISQLFunction arithmaticAddition = new VarArgsSQLFunction("(", "+", ")");
ICriteria c =
s.CreateCriteria( typeof( Person)).SetProjection(
Projections.Min(Projections.SqlFunction(arithmaticAddition, NHibernateUtil.GuessType( typeof( double)),
Projections.Property("IQ"), Projections.Property("ShoeSize"))));
IList list = c.List();
Assert.AreEqual(19, list[0]);
}
}
|
| ||||
[Test]
public void CanMaxProjectionOnIdentityProjection()
{
using (ISession s = OpenSession())
{
ISQLFunction arithmaticAddition = new VarArgsSQLFunction("(", "+", ")");
ICriteria c =
s.CreateCriteria( typeof( Person)).SetProjection(
Projections.Max(Projections.SqlFunction(arithmaticAddition, NHibernateUtil.GuessType( typeof( double)),
Projections.Property("IQ"), Projections.Property("ShoeSize"))));
IList list = c.List();
Assert.AreEqual(108, list[0]);
}
}
|
| |||
[Test]
public void [[#variable2d83af20]]()
{
using (ISession s = OpenSession())
{
ISQLFunction arithmaticAddition = new VarArgsSQLFunction("(", "+", ")");
ICriteria c = s.CreateCriteria( typeof(Person)).SetProjection(Projections. [[#variable2d83aec0]](Projections.SqlFunction(arithmaticAddition, NHibernateUtil.GuessType( typeof(double)), Projections.Property("IQ"), Projections.Property("ShoeSize"))));
IList list = c.List();
Assert.AreEqual( [[#variable2d83ae40]], list[0]);
}
}
|
| CloneAbstraction |
| Parameter Index | Clone Instance | Parameter Name | Value |
|---|---|---|---|
| 1 | 1 | [[#2d83af20]] | CanSumProjectionOnSqlFunction |
| 1 | 2 | [[#2d83af20]] | CanAvgProjectionOnSqlFunction |
| 1 | 3 | [[#2d83af20]] | CanMinProjectionOnIdentityProjection |
| 1 | 4 | [[#2d83af20]] | CanMaxProjectionOnIdentityProjection |
| 2 | 1 | [[#2d83aec0]] | Sum |
| 2 | 2 | [[#2d83aec0]] | Avg |
| 2 | 3 | [[#2d83aec0]] | Min |
| 2 | 4 | [[#2d83aec0]] | Max |
| 3 | 1 | [[#2d83ae40]] | 334 |
| 3 | 2 | [[#2d83ae40]] | ((double)334) / 5 |
| 3 | 3 | [[#2d83ae40]] | 19 |
| 3 | 4 | [[#2d83ae40]] | 108 |