Beispiel #1
0
 public void FixtureSetup()
 {
     using (var db = new TestEf6SchemaCompareDb())
     {
         var decoder = new Ef6MetadataDecoder(Assembly.GetAssembly(typeof(DataTop)));
         _efInfos = decoder.GetAllEfTablesWithColInfo(db);
     }
 }
 public void FixtureSetup()
 {
     using (var db = new TestEf6SchemaCompareDb())
     {
         var decoder = new Ef6MetadataDecoder(Assembly.GetAssembly(typeof(DataTop)));
         _efInfos = decoder.GetAllEfTablesWithColInfo(db);
         var allSqlInfo = SqlAllInfo.SqlAllInfoFactory(db.Database.Connection.ConnectionString);
         _checker = new EfRelationshipChecker(_efInfos, allSqlInfo, allSqlInfo.TableInfos);     //NOTE: we aren't able to filter potentialManyToManyTables
     }
 }
Beispiel #3
0
        public void Test11CompareEfWithDbUpSqlTOk()
        {
            using (var db = new TestEf6SchemaCompareDb())
            {
                //SETUP
                var comparer = new CompareEfSql();

                //EXECUTE
                var status = comparer.CompareEfWithDb <DataTop>(db, MiscConstants.DbUpDatabaseConfigName);

                //VERIFY
                status.ShouldBeValid();
                status.Warnings.Count.ShouldEqual(0, string.Join("\n", status.Warnings));
            }
        }
Beispiel #4
0
        public void Test02CompareEfWithSqlTOk()
        {
            using (var db = new TestEf6SchemaCompareDb())
            {
                //SETUP
                var comparer = new CompareEfSql();

                //EXECUTE
                var status = comparer.CompareEfWithDb <DataTop>(db);

                //VERIFY
                status.ShouldBeValid();
                Console.WriteLine("WARNINGS:\n {0}", string.Join("\n", status.Warnings));
            }
        }
        public void Test30CompareEfGeneratedSqlToSqlOk()
        {
            using (var db = new TestEf6SchemaCompareDb())
            {
                //SETUP
                var comparer = new CompareSqlSql();

                //EXECUTE
                var status = comparer.CompareEfGeneratedSqlToSql(db, MiscConstants.DbUpDatabaseConfigName);

                //VERIFY
                status.ShouldBeValid();
                status.HasWarnings.ShouldEqual(false, string.Join("\n", status.Warnings));
            }
        }
Beispiel #6
0
        public void Test40GetEfDataBad()
        {
            using (var db = new TestEf6SchemaCompareDb())
            {
                //SETUP
                var comparer = new CompareEfSql();

                //EXECUTE
                var ex =
                    Assert.Throws <InvalidOperationException>(
                        () => comparer.CompareEfWithDb <EfCompare>(db, MiscConstants.DbUpDatabaseConfigName));

                //VERIFY
                ex.Message.ShouldStartWith("Could not find the EF data class");
            }
        }
Beispiel #7
0
        public void Test01GetEfTableColumnInfo()
        {
            using (var db = new TestEf6SchemaCompareDb("DbUpSchemaCompareDb"))
            {
                //SETUP

                //EXECUTE
                var data = new DataTop
                {
                    MyString     = "Hello",
                    ManyChildren = new Collection <DataManyChildren>
                    {
                        new DataManyChildren
                        {
                            MyInt = 1
                        }
                    }
                };
                db.DataTops.Add(data);
                db.SaveChanges();

                //VERIFY
            }
        }