コード例 #1
0
        public void Verify_AddMappingAssembly_WorksProperly()
        {
            var dbModel = new EfDbModel(x => { return(null); });

            dbModel.AddMappingAssembly(Assembly.GetExecutingAssembly());

            Assert.That(dbModel.MappingAssemblies.Count, Is.EqualTo(1));
        }
コード例 #2
0
        public void Verify_CreateModel_WorksProperly()
        {
            var mockModelBuilder = new Mock <DbModelBuilder>();
            var mockOfDbMap      = new Mock <IDbMap>();

            Func <Type, IDbMap> getInstanceOfDbMapBehaviour = (x) =>
            {
                return(mockOfDbMap.Object);
            };

            var dbModel = new EfDbModel(getInstanceOfDbMapBehaviour);

            dbModel.AddMappingAssembly(Assembly.GetExecutingAssembly());

            dbModel.CreateModel(mockModelBuilder.Object);

            mockOfDbMap.Verify(x => x.SetModelBuilder(mockModelBuilder.Object), Times.Once());
            mockOfDbMap.Verify(x => x.Map(), Times.Once());
        }