public static void AssertIsEqual(ModelWithIdAndName actual, ModelWithIdAndName expected) { if (actual == null || expected == null) { Assert.That(actual == expected, Is.True); return; } Assert.That(actual.Id, Is.EqualTo(expected.Id)); Assert.That(actual.Name, Is.EqualTo(expected.Name)); }
public bool Equals(ModelWithIdAndName other) { if (object.ReferenceEquals(null, other)) { return(false); } if (object.ReferenceEquals(this, other)) { return(true); } if (other.Id == this.Id) { return(object.Equals(other.Name, this.Name)); } return(false); }
public bool Equals(ModelWithIdAndName other) { if (object.ReferenceEquals(null, other)) { return false; } if (object.ReferenceEquals(this, other)) { return true; } if (other.Id == this.Id) { return object.Equals(other.Name, this.Name); } return false; }
public void Can_Select_In_for_string_value() { const int n = 5; using (var db = new OrmLiteConnectionFactory(ConnectionString, FirebirdDialect.Provider).Open()) { db.CreateTable<ModelWithIdAndName>(true); db.DeleteAll<ModelWithIdAndName>(); for (int i = 1; i <= n; i++) { ModelWithIdAndName m = new ModelWithIdAndName() { Name = "Name" + i.ToString() }; db.Insert(m); } var selectInNames = new[] {"Name1", "Name2"}; var rows = db.Select<ModelWithIdAndName>("Name IN ({0})", selectInNames.SqlInValues()); Assert.That(rows.Count, Is.EqualTo(selectInNames.Length)); } }