Previous CloneSet | Next CloneSet | Back to Main Report |
Clone Mass | Clones in CloneSet | Parameter Count | Clone Similarity | Syntax Category [Sequence Length] |
---|---|---|---|---|
21 | 2 | 2 | 0.981 | class_member_declaration |
Clone Abstraction | Parameter Bindings |
Clone Instance (Click to see clone) | Line Count | Source Line | Source File |
---|---|---|---|
1 | 21 | 118 | src/NHibernate.Test/NHSpecificTest/NH1291AnonExample/NH1291AnonExampleFixture.cs |
2 | 22 | 159 | src/NHibernate.Test/NHSpecificTest/NH1291AnonExample/NH1291AnonExampleFixture.cs |
| ||||
[Test] public void CanQueryUsingSavedRelations() { using (ISession s = OpenSession()) { using (ITransaction tx = s.BeginTransaction()) { IList<Person> people = s.CreateCriteria( typeof(Person)).List<Person> (); Home h1 = new Home("Eugene", 97402); Home h2 = new Home("Klamath Falls", 97603); people[0].Home = h1; people[1].Home = h2; s.Save(h1); s.Save(h2); IList list = s.CreateCriteria( typeof(Person)).CreateCriteria("Home"). Add (Example.Create(h1)).List(); Assert.AreEqual(1, list.Count); Assert.AreEqual("Joe", ((Person)list[0]).Name); tx.Commit(); } } } |
| ||||
[Test] public void CanQueryUsingAnonRelations() { using (ISession s = OpenSession()) { using (ITransaction tx = s.BeginTransaction()) { IList<Person> people = s.CreateCriteria( typeof(Person)).List<Person> (); Home h1 = new Home("Eugene", 97402); Home h2 = new Home("Klamath Falls", 97603); people[0].Home = h1; people[1].Home = h2; s.Save(h1); s.Save(h2); IList list = s.CreateCriteria( typeof(Person)). CreateCriteria("Home").Add(Example.Create(new HomeAnon(97402))).List(); //c# 3.5: Example.Create( new { Zip = 97402 } ) Assert.AreEqual(1, list.Count); Assert.AreEqual("Joe", ((Person)list[0]).Name); tx.Commit(); } } } |
| |||
[Test] public void [[#variable27af3ac0]]() { using (ISession s = OpenSession()) { using (ITransaction tx = s.BeginTransaction()) { IList<Person> people = s.CreateCriteria( typeof(Person)).List<Person> (); Home h1 = new Home("Eugene", 97402); Home h2 = new Home("Klamath Falls", 97603); people[0].Home = h1; people[1].Home = h2; s.Save(h1); s.Save(h2); IList list = s.CreateCriteria( typeof(Person)).CreateCriteria("Home").Add(Example.Create( [[#variable27af3a40]])).List(); //c# 3.5: Example.Create( new { Zip = 97402 } ) Assert.AreEqual(1, list.Count); Assert.AreEqual("Joe", ((Person)list[0]).Name); tx.Commit(); } } } |
CloneAbstraction |
Parameter Index | Clone Instance | Parameter Name | Value |
---|---|---|---|
1 | 1 | [[#27af3ac0]] | CanQueryUsingSavedRelations |
1 | 2 | [[#27af3ac0]] | CanQueryUsingAnonRelations |
2 | 1 | [[#27af3a40]] | h1 |
2 | 2 | [[#27af3a40]] | new HomeAnon(97402) |