public virtual void Use_provider_method_is_generated_correctly() { var codeGenerator = new MySqlCodeGenerator(new ProviderCodeGeneratorDependencies()); var result = codeGenerator.GenerateUseProvider("Data Source=Test"); Assert.Equal("UseMySql", result.Method); Assert.Collection( result.Arguments, a => Assert.Equal("Data Source=Test", a)); }
public virtual void Use_provider_method_is_generated_correctly() { var codeGenerator = new MySqlCodeGenerator( new ProviderCodeGeneratorDependencies( Enumerable.Empty <IProviderCodeGeneratorPlugin>())); var result = codeGenerator.GenerateUseProvider("Data Source=Test", providerOptions: null); Assert.Equal("UseMySql", result.Method); Assert.Collection( result.Arguments, a => Assert.Equal("Data Source=Test", a)); Assert.Null(result.ChainedCall); }
public virtual void Use_provider_method_is_generated_correctly_with_options() { var codeGenerator = new MySqlCodeGenerator( new ProviderCodeGeneratorDependencies( Enumerable.Empty <IProviderCodeGeneratorPlugin>())); var providerOptions = new MethodCallCodeFragment("SetProviderOption"); var result = codeGenerator.GenerateUseProvider("Data Source=Test", providerOptions); Assert.Equal("UseMySql", result.Method); Assert.Collection( result.Arguments, a => Assert.Equal("Data Source=Test", a), a => { var nestedClosure = Assert.IsType <NestedClosureCodeFragment>(a); Assert.Equal("x", nestedClosure.Parameter); Assert.Same(providerOptions, nestedClosure.MethodCall); }); Assert.Null(result.ChainedCall); }