Exemplo n.º 1
0
        public void SetTable_WithColumn()
        {
            var db = new EasyDb();

            db
            .SetTable <User>("users")
            .SetColumn("username", p => p.UserName);

            var table  = db.GetTable <User>();
            var result = table.MappingByColumnName["username"] as Column;

            Assert.AreEqual(typeof(User), table.ModelType);
            Assert.AreEqual("users", table.TableName);
            Assert.AreEqual(typeof(User), result.ModelType);
            Assert.AreEqual("users", result.TableName);
            Assert.AreEqual(typeof(Column), result.GetType());
            Assert.AreEqual("username", result.ColumnName);
            Assert.AreEqual("UserName", result.Property.Name);
            Assert.AreEqual(typeof(User), result.ModelType);
            Assert.AreEqual(false, result.IsDatabaseGenerated);
            Assert.AreEqual(false, result.IsIgnored);
        }