CloneSet118


Previous CloneSetNext CloneSetBack to Main Report
Clone
Mass
Clones in
CloneSet
Parameter
Count
Clone
Similarity
Syntax Category
[Sequence Length]
39250.992class_member_declaration
Clone AbstractionParameter Bindings
Clone Instance
(Click to see clone)
Line CountSource Line
Source File
13954
src/NHibernate.Test/NHSpecificTest/NH1490/Fixture.cs
23996
src/NHibernate.Test/NHSpecificTest/NH1490/Fixture.cs
Clone Instance
1
Line Count
39
Source Line
54
Source File
src/NHibernate.Test/NHSpecificTest/NH1490/Fixture.cs

                [Test]
                public void Also_Works_With_Filter()
                {
                        using (ISession s = OpenSession())
                        using (ITransaction tx = s.BeginTransaction())
                        {
                                Customer c = new Customer("Somebody");
                                c.Category = new Category("User");
                                s.Save(c.Category);
                                c.IsActive = true;
                                c.Category.IsActive = true;
                                s.Save(c);
                                tx.Commit();
                        }

                        using (ISession s = OpenSession())
                        {
                                s.DisableFilter("onlyActive");
                                IFilter fltr = s.EnableFilter("onlyActive");

                                if (Dialect is PostgreSQLDialect)
                                        fltr.SetParameter("activeFlag", true);
                                else
                                        fltr.SetParameter("activeFlag", 1);

                                // Customer is parametrized
                                IQuery query = s.CreateQuery("from Customer c where c.Name = :customerName");
                                query.SetParameter("customerName", "Somebody");
                                IList<Customer> customers = query.List<Customer> ();

                                Assert.That(customers.Count, Is.EqualTo(1), "IFilter applied and Customer parametrized on Name also works");
                        }

                        using (ISession s = OpenSession())
                        using (ITransaction tx = s.BeginTransaction())
                        {
                                s.Delete("from Customer");
                                s.Delete("from Category");
                                tx.Commit();
                        }
                }



Clone Instance
2
Line Count
39
Source Line
96
Source File
src/NHibernate.Test/NHSpecificTest/NH1490/Fixture.cs

                [Test]
                public void Incorrect_SQL_Translated_Params_Bug()
                {
                        using (ISession s = OpenSession())
                        using (ITransaction tx = s.BeginTransaction())
                        {
                                Customer c = new Customer("Somebody");
                                c.Category = new Category("User");
                                s.Save(c.Category);
                                c.IsActive = true;
                                c.Category.IsActive = true;
                                s.Save(c);
                                tx.Commit();
                        }

                        using (ISession s = OpenSession())
                        {
                                s.DisableFilter("onlyActive");
                                IFilter fltr = s.EnableFilter("onlyActive");
                                if (Dialect is PostgreSQLDialect)
                                        fltr.SetParameter("activeFlag", true);
                                else
                                        fltr.SetParameter("activeFlag", 1);

                                // related entity Customer.Category is parametrized
                                IQuery query = s.CreateQuery("from Customer c where c.Category.Name = :catName");
                                query.SetParameter("catName", "User");

                                IList<Customer> customers = query.List<Customer> ();

                                Assert.That(customers.Count, Is.EqualTo(1), "IFIlter applied and Customer parametrized on Category.Name DOES NOT work");
                        }

                        using (ISession s = OpenSession())
                        using (ITransaction tx = s.BeginTransaction())
                        {
                                s.Delete("from Customer");
                                s.Delete("from Category");
                                tx.Commit();
                        }
                }



Clone AbstractionParameter Count: 5Parameter Bindings

[Test]
public void [[#variable52089b40]]()
{
   using (ISession s = OpenSession())
      using (ITransaction tx = s.BeginTransaction())
      {
         Customer c = new Customer("Somebody");
         c.Category = new Category("User");
         s.Save(c.Category);
         c.IsActive = true;
         c.Category.IsActive = true;
         s.Save(c);
         tx.Commit();
      }
   using (ISession s = OpenSession())
   {
      s.DisableFilter("onlyActive");
      IFilter fltr = s.EnableFilter("onlyActive");
      if (Dialect is PostgreSQLDialect)
         fltr.SetParameter("activeFlag", true);
      else
         fltr.SetParameter("activeFlag", 1);
      // Customer is parametrized
      // related entity Customer.Category is parametrized
      IQuery query = s.CreateQuery( [[#variable52089a60]]);
      query.SetParameter( [[#variable52089a00]], [[#variable520899e0]]);
      IList<Customer> customers = query.List<Customer> ();
      Assert.That(customers.Count, Is.EqualTo(1), [[#variable52089960]]);
   }
   using (ISession s = OpenSession())
      using (ITransaction tx = s.BeginTransaction())
      {
         s.Delete("from Customer");
         s.Delete("from Category");
         tx.Commit();
      }
}

 

CloneAbstraction
Parameter Bindings
Parameter
Index
Clone
Instance
Parameter
Name
Value
11[[#52089b40]]
Also_Works_With_Filter 
12[[#52089b40]]
Incorrect_SQL_Translated_Params_Bug 
21[[#52089a60]]
"from Customer c where c.Name = :customerName" 
22[[#52089a60]]
"from Customer c where c.Category.Name = :catName" 
31[[#52089a00]]
"customerName" 
32[[#52089a00]]
"catName" 
41[[#520899e0]]
"Somebody" 
42[[#520899e0]]
"User" 
51[[#52089960]]
"IFilter applied and Customer parametrized on Name also works" 
52[[#52089960]]
"IFIlter applied and Customer parametrized on Category.Name DOES NOT work"