Exemple #1
0
        public void FindConstructor_FindsCorrectConstructor()
        {
            // Arrange
            MySqlDbContextConnectorFactory factory = new MySqlDbContextConnectorFactory();
            var info = factory.FindConstructor(typeof(GoodDbContext));

            Assert.NotNull(info);
            Assert.Equal(1, info.GetParameters().Length);
            Assert.Equal(typeof(string), info.GetParameters()[0].ParameterType);
        }
Exemple #2
0
        public void Create_ReturnsDbContext()
        {
            MySqlProviderConnectorOptions config = new MySqlProviderConnectorOptions()
            {
                Server   = "localhost",
                Port     = 3306,
                Password = "******",
                Username = "******",
                Database = "database"
            };
            MySqlServiceInfo si = new MySqlServiceInfo("MyId", "mysql://*****:*****@192.168.0.90:3306/cf_b4f8d2fa_a3ea_4e3a_a0e8_2cd040790355");
            var factory         = new MySqlDbContextConnectorFactory(si, config, typeof(GoodDbContext));
            var context         = factory.Create(null);

            Assert.NotNull(context);
            GoodDbContext gcontext = context as GoodDbContext;

            Assert.NotNull(gcontext);
        }