public void Select_WithSourceWithSchema_ToString() { const string expected = "Select dbo.Tab1.F1, dbo.Tab1.F2"; var source = new NamedSource("Tab1", "dbo"); var actual = _sqlGenerator.Select(new Field("F1", source), new Field("F2", source)) .ToString(); Assert.AreEqual(expected, actual); }
public void Select_WithSource_ToString() { const string expected = "Select Tab1.F1, Tab1.F2"; var source = new NamedSource("Tab1"); Generator.Select(new Field("F1", source), new Field("F2", source)); var actual = GenerateSqlString(); Assert.AreEqual(expected, actual); }
public void InstancesWithNamesWillBeAttachedToTheirInstrumentationListeners() { DictionaryConfigurationSource configSource = new DictionaryConfigurationSource(); configSource.Add(InstrumentationConfigurationSection.SectionName, new InstrumentationConfigurationSection(true, true, true)); MockBuilderContext context = new MockBuilderContext(); context.Policies.AddPolicies(GetPolicies(configSource)); InstrumentationStrategy strategy = new InstrumentationStrategy(); NamedSource namedSource = new NamedSource(); NamedSource createdObject = strategy.BuildUp<NamedSource>(context, namedSource, "Foo"); Assert.IsTrue(createdObject.IsWired); }
public void InstancesWithNamesWillBeAttachedToTheirInstrumentationListeners() { DictionaryConfigurationSource configSource = new DictionaryConfigurationSource(); configSource.Add(InstrumentationConfigurationSection.SectionName, new InstrumentationConfigurationSection(true, true, true)); MockBuilderContext context = new MockBuilderContext(); context.Policies.AddPolicies(GetPolicies(configSource)); InstrumentationStrategy strategy = new InstrumentationStrategy(); NamedSource namedSource = new NamedSource(); NamedSource createdObject = strategy.BuildUp <NamedSource>(context, namedSource, "Foo"); Assert.IsTrue(createdObject.IsWired); }
// ReSharper disable UnusedMethodReturnValue.Global protected ISqlGenerator SelectField(string fieldName, object source = null, string alias = "") // ReSharper restore UnusedMethodReturnValue.Global { ISource fieldSource = null; if (source is ISource) { fieldSource = (ISource)source; } else if (source is string) { fieldSource = new NamedSource((string)source); } return(SelectField(fieldName, fieldSource, alias)); }
public void InstancesWithNamesWillBeAttachedToTheirInstrumentationListeners() { DictionaryConfigurationSource configSource = new DictionaryConfigurationSource(); configSource.Add(InstrumentationConfigurationSection.SectionName, new InstrumentationConfigurationSection(true, true, true, "fooApplicationInstanceName")); NamedSource namedSource = new NamedSource(); BuilderContext context = new BuilderContext( new StrategyChain(), null, null, new PolicyList(GetPolicies(configSource)), NamedTypeBuildKey.Make <NamedSource>("Foo"), namedSource); InstrumentationStrategy strategy = new InstrumentationStrategy(); strategy.PreBuildUp(context); Assert.IsTrue(((NamedSource)context.Existing).IsWired); }