Previous CloneSet | Next CloneSet | Back to Main Report |
Clone Mass | Clones in CloneSet | Parameter Count | Clone Similarity | Syntax Category [Sequence Length] |
---|---|---|---|---|
87 | 2 | 6 | 0.988 | namespace_member_declarations |
Clone Abstraction | Parameter Bindings |
Clone Instance (Click to see clone) | Line Count | Source Line | Source File |
---|---|---|---|
1 | 87 | 5 | src/NHibernate.Test/TypesTest/EnumStringTypeFixture.cs |
2 | 88 | 7 | src/NHibernate.Test/TypesTest/GenericEnumStringTypeFixture.cs |
| ||||
namespace NHibernate.Test.TypesTest { [TestFixture] public class EnumStringTypeFixture : TypeFixtureBase { protected override string TypeName { get { return "EnumString"; } } protected override void OnSetUp() { EnumStringClass basic = new EnumStringClass(); basic.Id = 1; basic.EnumValue = SampleEnum.Dimmed; EnumStringClass basic2 = new EnumStringClass(); basic2.Id = 2; basic2.EnumValue = SampleEnum.On; ISession s = OpenSession(); s.Save(basic); s.Save(basic2); s.Flush(); s.Close(); } protected override void OnTearDown() { ISession s = OpenSession(); s.Delete("from EnumStringClass"); s.Flush(); s.Close(); } [Test] public void ReadFromLoad() { ISession s = OpenSession(); EnumStringClass basic = (EnumStringClass) s.Load( typeof(EnumStringClass), 1); Assert.AreEqual(SampleEnum.Dimmed, basic.EnumValue); EnumStringClass basic2 = (EnumStringClass) s.Load( typeof(EnumStringClass), 2); Assert.AreEqual(SampleEnum.On, basic2.EnumValue); s.Close(); } [Test] public void ReadFromQuery() { ISession s = OpenSession(); IQuery q = s.CreateQuery("from EnumStringClass as esc where esc.EnumValue=:enumValue"); q.SetParameter("enumValue", SampleEnum.On, new SampleEnumType()); IList results = q.List(); Assert.AreEqual(1, results.Count, "only 1 was 'On'"); q.SetParameter("enumValue", SampleEnum.Off, new SampleEnumType()); results = q.List(); Assert.AreEqual(0, results.Count, "should not be any in the 'Off' status"); s.Close(); // it will also be possible to query based on a string value // since that is what is in the db s = OpenSession(); q = s.CreateQuery("from EnumStringClass as esc where esc.EnumValue=:stringValue"); q.SetString("stringValue", "On"); results = q.List(); Assert.AreEqual(1, results.Count, "only 1 was 'On' string"); q.SetString("stringValue", "Off"); results = q.List(); Assert.AreEqual(0, results.Count, "should not be any in the 'Off' string"); s.Close(); } } } |
| ||||
namespace NHibernate.Test.TypesTest { [TestFixture] public class GenericEnumStringTypeFixture : TypeFixtureBase { protected override string TypeName { get { return "GenericEnumString"; } } protected override void OnSetUp() { GenericEnumStringClass basic = new GenericEnumStringClass(); basic.Id = 1; basic.EnumValue = SampleEnum.Dimmed; GenericEnumStringClass basic2 = new GenericEnumStringClass(); basic2.Id = 2; basic2.EnumValue = SampleEnum.On; ISession s = OpenSession(); s.Save(basic); s.Save(basic2); s.Flush(); s.Close(); } protected override void OnTearDown() { ISession s = OpenSession(); s.Delete("from GenericEnumStringClass"); s.Flush(); s.Close(); } [Test] public void ReadFromLoad() { ISession s = OpenSession(); GenericEnumStringClass basic = (GenericEnumStringClass)s.Load( typeof(GenericEnumStringClass), 1); Assert.AreEqual(SampleEnum.Dimmed, basic.EnumValue); GenericEnumStringClass basic2 = (GenericEnumStringClass)s.Load( typeof(GenericEnumStringClass), 2); Assert.AreEqual(SampleEnum.On, basic2.EnumValue); s.Close(); } [Test] public void ReadFromQuery() { ISession s = OpenSession(); IQuery q = s.CreateQuery("from GenericEnumStringClass as esc where esc.EnumValue=:enumValue"); q.SetParameter("enumValue", SampleEnum.On, new SampleEnumType()); IList results = q.List(); Assert.AreEqual(1, results.Count, "only 1 was 'On'"); q.SetParameter("enumValue", SampleEnum.Off, new SampleEnumType()); results = q.List(); Assert.AreEqual(0, results.Count, "should not be any in the 'Off' status"); s.Close(); // it will also be possible to query based on a string value // since that is what is in the db s = OpenSession(); q = s.CreateQuery("from GenericEnumStringClass as esc where esc.EnumValue=:stringValue"); q.SetString("stringValue", "On"); results = q.List(); Assert.AreEqual(1, results.Count, "only 1 was 'On' string"); q.SetString("stringValue", "Off"); results = q.List(); Assert.AreEqual(0, results.Count, "should not be any in the 'Off' string"); s.Close(); } } } |
| |||
namespace NHibernate.Test.TypesTest { [TestFixture] public class [[#variable6e5843e0]]: TypeFixtureBase { protected override string TypeName { get { return [[#variable6e584340]]; } } protected override void OnSetUp() { [[#variable6e584280]]basic = new [[#variable6e584280]](); basic.Id = 1; basic.EnumValue = SampleEnum.Dimmed; [[#variable6e584280]]basic2 = new [[#variable6e584280]](); basic2.Id = 2; basic2.EnumValue = SampleEnum.On; ISession s = OpenSession(); s.Save(basic); s.Save(basic2); s.Flush(); s.Close(); } protected override void OnTearDown() { ISession s = OpenSession(); s.Delete( [[#variable6e584220]]); s.Flush(); s.Close(); } [Test] public void ReadFromLoad() { ISession s = OpenSession(); [[#variable6e584280]]basic = ( [[#variable6e584280]])s.Load( typeof( [[#variable6e584280]]), 1); Assert.AreEqual(SampleEnum.Dimmed, basic.EnumValue); [[#variable6e584280]]basic2 = ( [[#variable6e584280]])s.Load( typeof( [[#variable6e584280]]), 2); Assert.AreEqual(SampleEnum.On, basic2.EnumValue); s.Close(); } [Test] public void ReadFromQuery() { ISession s = OpenSession(); IQuery q = s.CreateQuery( [[#variable6e5841c0]]); q.SetParameter("enumValue", SampleEnum.On, new SampleEnumType()); IList results = q.List(); Assert.AreEqual(1, results.Count, "only 1 was 'On'"); q.SetParameter("enumValue", SampleEnum.Off, new SampleEnumType()); results = q.List(); Assert.AreEqual(0, results.Count, "should not be any in the 'Off' status"); s.Close(); // it will also be possible to query based on a string value // since that is what is in the db s = OpenSession(); q = s.CreateQuery( [[#variable6e584160]]); q.SetString("stringValue", "On"); results = q.List(); Assert.AreEqual(1, results.Count, "only 1 was 'On' string"); q.SetString("stringValue", "Off"); results = q.List(); Assert.AreEqual(0, results.Count, "should not be any in the 'Off' string"); s.Close(); } } } |
CloneAbstraction |
Parameter Index | Clone Instance | Parameter Name | Value |
---|---|---|---|
1 | 1 | [[#6e5843e0]] | EnumStringTypeFixture |
1 | 2 | [[#6e5843e0]] | GenericEnumStringTypeFixture |
2 | 1 | [[#6e584340]] | "EnumString" |
2 | 2 | [[#6e584340]] | "GenericEnumString" |
3 | 1 | [[#6e584280]] | EnumStringClass |
3 | 2 | [[#6e584280]] | GenericEnumStringClass |
4 | 1 | [[#6e584220]] | "from EnumStringClass" |
4 | 2 | [[#6e584220]] | "from GenericEnumStringClass" |
5 | 1 | [[#6e5841c0]] | "from EnumStringClass as esc where esc.EnumValue=:enumValue" |
5 | 2 | [[#6e5841c0]] | "from GenericEnumStringClass as esc where esc.EnumValue=:enumValue" |
6 | 1 | [[#6e584160]] | "from EnumStringClass as esc where esc.EnumValue=:stringValue" |
6 | 2 | [[#6e584160]] | "from GenericEnumStringClass as esc where esc.EnumValue=:stringValue" |