public void GetSystemUnderTest_Build_CorrectDiscoveryCommand() { var sutXmlStubFactory = new Mock <Systems.ExecutionXml>(); var itemXmlStubFactory = new Mock <QueryableXml>(); itemXmlStubFactory.Setup(i => i.GetQuery()).Returns("query"); sutXmlStubFactory.Setup(s => s.Item).Returns(itemXmlStubFactory.Object); var sutXml = sutXmlStubFactory.Object; sutXml.Item = itemXmlStubFactory.Object; var ctrXml = new EqualToXml(SettingsXml.Empty); ctrXml.Query = new Items.QueryXml() { InlineQuery = "query" }; var builder = new ResultSetEqualToBuilder(); builder.Setup(sutXml, ctrXml); builder.Build(); var sut = builder.GetSystemUnderTest(); Assert.That(sut, Is.InstanceOf <IDbCommand>()); }
public void GetSystemUnderTest_ResultSetSystemXml_IResultSetService() { var sutXmlStub = new Mock <Systems.ResultSetSystemXml>(); sutXmlStub.Setup(s => s.File.Path).Returns("myFile.csv"); var sutXml = sutXmlStub.Object; var ctrXmlStubFactory = new Mock <SupersetOfXml>(); ctrXmlStubFactory.SetupGet(i => i.BaseItem).Returns(new QueryXml() { InlineQuery = "select * from Table;", ConnectionString = "connStr" }); ctrXmlStubFactory.SetupGet(i => i.Settings).Returns(SettingsXml.Empty); var ctrXml = ctrXmlStubFactory.Object; var builder = new ResultSetEqualToBuilder(); builder.Setup(sutXml, ctrXml, null, null, new ServiceLocator()); builder.Build(); var sut = builder.GetSystemUnderTest(); Assert.That(sut, Is.Not.Null); Assert.That(sut, Is.InstanceOf <IResultSetService>()); }
public void GetSystemUnderTest_ExecutionXml_IResultSetService() { var sutXmlStubFactory = new Mock <Systems.ExecutionXml>(); var itemXmlStubFactory = new Mock <QueryableXml>(); itemXmlStubFactory.Setup(i => i.GetQuery()).Returns("query"); sutXmlStubFactory.Setup(s => s.Item).Returns(itemXmlStubFactory.Object); var sutXml = sutXmlStubFactory.Object; sutXml.Item = itemXmlStubFactory.Object; var ctrXmlStubFactory = new Mock <EqualToXml>(); ctrXmlStubFactory.Setup(i => i.GetCommand()).Returns(new SqlCommand()); ctrXmlStubFactory.SetupGet(i => i.BaseItem).Returns(new QueryXml() { InlineQuery = "select * from Table;" }); ctrXmlStubFactory.SetupGet(i => i.Settings).Returns(SettingsXml.Empty); var ctrXml = ctrXmlStubFactory.Object; var builder = new ResultSetEqualToBuilder(); builder.Setup(sutXml, ctrXml, null, null, new ServiceLocator()); builder.Build(); var sut = builder.GetSystemUnderTest(); Assert.That(sut, Is.Not.Null); Assert.That(sut, Is.InstanceOf <IResultSetService>()); }
public void GetSystemUnderTest_ExecutionXml_IResultSetService() { var sutXmlStubFactory = new Mock <Systems.ExecutionXml>(); var itemXmlStubFactory = new Mock <QueryableXml>(); itemXmlStubFactory.Setup(i => i.GetQuery()).Returns("query"); sutXmlStubFactory.Setup(s => s.Item).Returns(itemXmlStubFactory.Object); var sutXml = sutXmlStubFactory.Object; sutXml.Item = itemXmlStubFactory.Object; var ctrXml = new SupersetOfXml(SettingsXml.Empty) { Query = new QueryXml() { InlineQuery = "query" } }; var builder = new ResultSetEqualToBuilder(); builder.Setup(sutXml, ctrXml); builder.Build(); var sut = builder.GetSystemUnderTest(); Assert.That(sut, Is.Not.Null); Assert.That(sut, Is.InstanceOf <IResultSetService>()); }
public void GetSystemUnderTest_ResultSetSystemXml_IResultSetService() { var sutXmlStub = new Mock <Systems.ResultSetSystemXml>(); sutXmlStub.Setup(s => s.File).Returns("myFile.csv"); var sutXml = sutXmlStub.Object; var ctrXml = new SupersetOfXml(SettingsXml.Empty) { Query = new QueryXml() { InlineQuery = "select * from query" } }; var builder = new ResultSetEqualToBuilder(); builder.Setup(sutXml, ctrXml); builder.Build(); var sut = builder.GetSystemUnderTest(); Assert.That(sut, Is.Not.Null); Assert.That(sut, Is.InstanceOf <IResultSetService>()); }