Exemple #1
0
        public void Verify_CreateDbContext_WorksProperly_AfterSetAllProperties()
        {
            string          connStringSample = "A_Conn_String";
            Action <string> logAction        = (x) => { };

            var dbModel = new EfDbModel(x => { return(null); });

            bool funcCalledCorrecly = false;
            Func <string, EfDbModel> createDbContextBehaviour = (cs) =>
            {
                if (cs == connStringSample)
                {
                    funcCalledCorrecly = true;
                }

                return(dbModel);
            };

            var dbContext = new EfDbContext(createDbContextBehaviour)
                            .SetConnectionString(connStringSample);

            dbContext.CreateNewContext();
            Assert.True(funcCalledCorrecly);

            dbContext.AddMappingFromAssemblyOf <TestEntityMap>();
            Assert.That(dbModel.MappingAssemblies.Count, Is.EqualTo(1));
        }