public void EqualsWithDependencies() { var filter = new Extent(M.Person.ObjectType) { Predicate = new Equals { Dependencies = new[] { "useFirstname" }, PropertyType = M.Person.FirstName, Value = "John" }, }; var arguments = new Dictionary <string, string> { }; var queryExtent = filter.Build(this.Session, arguments); var extent = this.Session.Extent(M.Person.ObjectType); Assert.Equal(extent.ToArray(), queryExtent.ToArray()); arguments.Add("useFirstname", "x"); queryExtent = filter.Build(this.Session, arguments); extent = this.Session.Extent(M.Person.ObjectType); extent.Filter.AddEquals(M.Person.FirstName, "John"); Assert.Equal(extent.ToArray(), queryExtent.ToArray()); }
public void AndNestedContainsWithoutParameters() { var filter = new Extent(M.Organisation.ObjectType) { Predicate = new And { Operands = new IPredicate[] { new ContainedIn { PropertyType = M.Organisation.Employees, Extent = new Extent(M.Person.ObjectType) { Predicate = new Contains { PropertyType = M.Person.Gender, Parameter = "gender", }, }, }, }, }, }; var arguments = new Dictionary <string, string>(); var queryExtent = filter.Build(this.Session, arguments); var extent = this.Session.Extent(M.Organisation.ObjectType); Assert.Equal(extent.ToArray(), queryExtent.ToArray()); }
public void NestedWithParameters() { var filter = new Extent(M.Organisation.ObjectType) { Predicate = new ContainedIn { PropertyType = M.Organisation.Employees, Extent = new Extent(M.Person.ObjectType) { Predicate = new Equals { PropertyType = M.Person.Gender, Parameter = "gender", }, }, }, }; var male = new Genders(this.Session).Male; var arguments = new Dictionary <string, string> { { "gender", male.Id.ToString() } }; var queryExtent = filter.Build(this.Session, arguments); var employees = this.Session.Extent(M.Person.ObjectType); employees.Filter.AddEquals(M.Person.Gender, male); var extent = this.Session.Extent(M.Organisation.ObjectType); extent.Filter.AddContainedIn(M.Organisation.Employees, employees); Assert.Equal(extent.ToArray(), queryExtent.ToArray()); }
public void AndWithoutParameters() { // select from Person where FirstName='John' and LastName='Doe' var filter = new Extent(M.Person.ObjectType) { Predicate = new And { Operands = new IPredicate[] { new Equals { PropertyType = M.Person.FirstName, Parameter = "firstName", }, new Equals { PropertyType = M.Person.LastName, Parameter = "lastName" }, }, }, }; { var arguments = new Dictionary <string, string> { { "firstName", "John" }, }; var queryExtent = filter.Build(this.Session, arguments); var extent = this.Session.Extent(M.Person.ObjectType); extent.Filter.AddEquals(M.Person.FirstName, "John"); Assert.Equal(extent.ToArray(), queryExtent.ToArray()); } { var queryExtent = filter.Build(this.Session); var extent = this.Session.Extent(M.Person.ObjectType); Assert.Equal(extent.ToArray(), queryExtent.ToArray()); } }
public void EqualsWithoutParameters() { var filter = new Extent(M.Person.ObjectType) { Predicate = new Equals { PropertyType = M.Person.FirstName, Parameter = "firstName" }, }; var queryExtent = filter.Build(this.Session); var extent = this.Session.Extent(M.Person.ObjectType); Assert.Equal(extent.ToArray(), queryExtent.ToArray()); }
public void EqualsWithParameters() { var filter = new Extent(M.Person.ObjectType) { Predicate = new Equals { PropertyType = M.Person.FirstName, Parameter = "firstName" }, }; var arguments = new Dictionary <string, string> { { "firstName", "John" } }; var queryExtent = filter.Build(this.Session, arguments); var extent = this.Session.Extent(M.Person.ObjectType); extent.Filter.AddEquals(M.Person.FirstName, "John"); Assert.Equal(extent.ToArray(), queryExtent.ToArray()); }