Previous CloneSet | Next CloneSet | Back to Main Report |
Clone Mass | Clones in CloneSet | Parameter Count | Clone Similarity | Syntax Category [Sequence Length] |
---|---|---|---|---|
27 | 2 | 6 | 0.959 | class_member_declaration |
Clone Abstraction | Parameter Bindings |
Clone Instance (Click to see clone) | Line Count | Source Line | Source File |
---|---|---|---|
1 | 27 | 58 | src/NHibernate.Test/NHSpecificTest/NH266/Fixture.cs |
2 | 24 | 91 | src/NHibernate.Test/NHSpecificTest/NH266/Fixture.cs |
| ||||
[Test] public void BaseClassLoad() { // just do a straight load ISession s = OpenSession(); A a = s.Load( typeof(A), aId) as A; Assert.AreEqual("the a", a.Name); s.Close(); // load instance through hql s = OpenSession(); IQuery q = s.CreateQuery("from A as a where a.id = :id "); q.SetParameter("id", aId); a = q.UniqueResult() as A; Assert.AreEqual("the a", a.Name); s.Close(); // load instance through Criteria s = OpenSession(); ICriteria c = s.CreateCriteria( typeof(A)); c.Add(Expression.Eq("Id", aId)); a = c.UniqueResult() as A; Assert.AreEqual("the a", a.Name); s.Close(); } |
| ||||
/// <summary> /// This is testing problems that existed in 0.8.0-2 with extra "AND" /// being added to the sql when there was a discriminator-value. /// </summary> [Test] public void SpecificSubclass() { ISession s = OpenSession(); B b = s.Load( typeof(B), bId) as B; Assert.AreEqual("the b", b.Name); s.Close(); // load a instance of B through hql s = OpenSession(); IQuery q = s.CreateQuery("from B as b where b.id = :id"); q.SetParameter("id", bId); b = q.UniqueResult() as B; Assert.AreEqual("the b", b.Name); s.Close(); // load a instance of B through Criteria s = OpenSession(); ICriteria c = s.CreateCriteria( typeof(B)); c.Add(Expression.Eq("Id", bId)); b = c.UniqueResult() as B; Assert.AreEqual("the b", b.Name); s.Close(); } |
| |||
/// <summary> /// This is testing problems that existed in 0.8.0-2 with extra "AND" /// being added to the sql when there was a discriminator-value. /// </summary> [Test] public void [[#variable66353e00]]() { // just do a straight load ISession s = OpenSession(); [[#variable66353d60]] [[#variable66353ce0]]= s.Load( typeof( [[#variable66353d60]]), [[#variable66353c80]]) as [[#variable66353d60]]; Assert.AreEqual( [[#variable66353be0]], [[#variable66353ce0]].Name); s.Close(); // load instance through hql // load a instance of B through hql s = OpenSession(); IQuery q = s.CreateQuery( [[#variable66353b60]]); q.SetParameter("id", [[#variable66353c80]]); [[#variable66353ce0]]= q.UniqueResult() as [[#variable66353d60]]; Assert.AreEqual( [[#variable66353be0]], [[#variable66353ce0]].Name); s.Close(); // load instance through Criteria // load a instance of B through Criteria s = OpenSession(); ICriteria c = s.CreateCriteria( typeof( [[#variable66353d60]])); c.Add(Expression.Eq("Id", [[#variable66353c80]])); [[#variable66353ce0]]= c.UniqueResult() as [[#variable66353d60]]; Assert.AreEqual( [[#variable66353be0]], [[#variable66353ce0]].Name); s.Close(); } |
CloneAbstraction |
Parameter Index | Clone Instance | Parameter Name | Value |
---|---|---|---|
1 | 1 | [[#66353e00]] | BaseClassLoad |
1 | 2 | [[#66353e00]] | SpecificSubclass |
2 | 1 | [[#66353d60]] | A |
2 | 2 | [[#66353d60]] | B |
3 | 1 | [[#66353ce0]] | a |
3 | 2 | [[#66353ce0]] | b |
4 | 1 | [[#66353c80]] | aId |
4 | 2 | [[#66353c80]] | bId |
5 | 1 | [[#66353be0]] | "the a" |
5 | 2 | [[#66353be0]] | "the b" |
6 | 1 | [[#66353b60]] | "from A as a where a.id = :id " |
6 | 2 | [[#66353b60]] | "from B as b where b.id = :id" |