CloneSet48


Previous CloneSetNext CloneSetBack to Main Report
Clone
Mass
Clones in
CloneSet
Parameter
Count
Clone
Similarity
Syntax Category
[Sequence Length]
87260.988namespace_member_declarations
Clone AbstractionParameter Bindings
Clone Instance
(Click to see clone)
Line CountSource Line
Source File
1875
src/NHibernate.Test/TypesTest/EnumStringTypeFixture.cs
2887
src/NHibernate.Test/TypesTest/GenericEnumStringTypeFixture.cs
Clone Instance
1
Line Count
87
Source Line
5
Source File
src/NHibernate.Test/TypesTest/EnumStringTypeFixture.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();
                }

        }
}


Clone Instance
2
Line Count
88
Source Line
7
Source File
src/NHibernate.Test/TypesTest/GenericEnumStringTypeFixture.cs

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();
                }

        }
}


Clone AbstractionParameter Count: 6Parameter Bindings

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 Bindings
Parameter
Index
Clone
Instance
Parameter
Name
Value
11[[#6e5843e0]]
EnumStringTypeFixture 
12[[#6e5843e0]]
GenericEnumStringTypeFixture 
21[[#6e584340]]
"EnumString" 
22[[#6e584340]]
"GenericEnumString" 
31[[#6e584280]]
EnumStringClass 
32[[#6e584280]]
GenericEnumStringClass 
41[[#6e584220]]
"from EnumStringClass" 
42[[#6e584220]]
"from GenericEnumStringClass" 
51[[#6e5841c0]]
"from EnumStringClass as esc where esc.EnumValue=:enumValue" 
52[[#6e5841c0]]
"from GenericEnumStringClass as esc where esc.EnumValue=:enumValue" 
61[[#6e584160]]
"from EnumStringClass as esc where esc.EnumValue=:stringValue" 
62[[#6e584160]]
"from GenericEnumStringClass as esc where esc.EnumValue=:stringValue"