protected override void SpecificSetup(AbstractSystemUnderTestXml sutXml, AbstractConstraintXml ctrXml) { if (!(ctrXml is ExistsXml)) throw new ArgumentException("Constraint must be a 'ExistsXml'"); ConstraintXml = (ExistsXml)ctrXml; }
protected global::NUnit.Framework.Constraints.Constraint InstantiateConstraint(ExistsXml ctrXml) { var ctr = new ExistsConstraint(); //Ignore-case if requested if (ctrXml.IgnoreCase) ctr = ctr.IgnoreCase; return ctr; }
protected NBiConstraint InstantiateConstraint(ExistsXml ctrXml, StructureXml sutXml) { var expected = sutXml.Item.Caption; var ctr = new ExistsConstraint(expected); //Ignore-case if requested if (ctrXml.IgnoreCase) ctr = ctr.IgnoreCase; return ctr; }
public void GetConstraint_Build_CorrectConstraint() { var sutXml = new StructureXml(); var item = new HierarchyXml(); item.ConnectionString = "connectionString"; item.Perspective = "perspective-name"; item.Dimension = "dimension-caption"; item.Caption = "hierarchy-caption"; sutXml.Item = item; var ctrXml = new ExistsXml(); var builder = new StructureExistsBuilder(); builder.Setup(sutXml, ctrXml); builder.Build(); var ctr = builder.GetConstraint(); Assert.That(ctr, Is.InstanceOf<ExistsConstraint>()); }
public void GetConstraint_BuildWithoutIgnoreCase_ComparerCaseSensitive() { var sutXml = new StructureXml(); var item = new PerspectiveXml(); sutXml.Item = item; item.ConnectionString = "connectionString"; item.Caption = "perspective"; var ctrXml = new ExistsXml(); var builder = new StructureExistsBuilder(); builder.Setup(sutXml, ctrXml); builder.Build(); var ctr = builder.GetConstraint(); var existsCtr = (ExistsConstraint)ctr; Assert.That(existsCtr.Comparer, Is.InstanceOf<NBi.Core.Analysis.Metadata.Field.ComparerByCaption>()); Assert.That(existsCtr.Comparer.Compare("c", "C"), Is.Not.EqualTo(0)); }
public void GetConstraint_BuildWithIgnoreCase_ComparerCaseInsensitive() { var sutXml = new StructureXml(); var item = new PerspectiveXml(); sutXml.Item = item; item.ConnectionString = ConnectionStringReader.GetAdomd(); item.Caption = "perspective"; var ctrXml = new ExistsXml(); ctrXml.IgnoreCase = true; var builder = new StructureExistsBuilder(); builder.Setup(sutXml, ctrXml); builder.Build(); var ctr = builder.GetConstraint(); var existsCtr = (ExistsConstraint)ctr; Assert.That(existsCtr.Comparer, Is.InstanceOf<CaseInsensitiveComparer>()); Assert.That(existsCtr.Comparer.Compare("c", "C"), Is.EqualTo(0)); }
public void GetSystemUnderTest_Build_CorrectSystemUnderTest() { var sutXml = new StructureXml(); var item = new PerspectiveXml(); sutXml.Item = item; item.ConnectionString = "connectionString"; item.Caption = "perspective"; var ctrXml = new ExistsXml(); var builder = new StructureExistsBuilder(); builder.Setup(sutXml, ctrXml); builder.Build(); var sut = builder.GetSystemUnderTest(); Assert.That(sut, Is.InstanceOf<MetadataDiscoveryRequest>()); }
public void IsHandling_StructureExists_True() { var sutXml = new StructureXml(); var ctrXml = new ExistsXml(); var testCaseFactory = new TestCaseFactory(); var actual = testCaseFactory.IsHandling(sutXml.GetType(), ctrXml.GetType()); Assert.That(actual, Is.True); }
public void IsHandling_QueryExists_False() { var sutXml = new ExecutionXml(); var ctrXml = new ExistsXml(); var testCaseFactory = new TestCaseFactory(); var actual = testCaseFactory.IsHandling(sutXml.GetType(), ctrXml.GetType()); Assert.That(actual, Is.False); }
public void Instantiate_StructureExists_TestCase() { var sutXml = new StructureXml(); var ctrXml = new ExistsXml(); var builderMockFactory = new Mock<ITestCaseBuilder>(); builderMockFactory.Setup(b => b.Setup(sutXml, ctrXml, TestConfiguration.Default)); builderMockFactory.Setup(b => b.Build()); builderMockFactory.Setup(b => b.GetSystemUnderTest()).Returns(new object()); builderMockFactory.Setup(b => b.GetConstraint()).Returns(new ExistsConstraint("foo")); var builder = builderMockFactory.Object; var testCaseFactory = new TestCaseFactory(); testCaseFactory.Register(typeof(StructureXml), typeof(ExistsXml), builder); var tc = testCaseFactory.Instantiate(sutXml, ctrXml); Assert.That(tc, Is.Not.Null); builderMockFactory.VerifyAll(); }
public void Instantiate_QueryExists_ArgumentException() { var sutXml = new ExecutionXml(); var ctrXml = new ExistsXml(); var testCaseFactory = new TestCaseFactory(); Assert.Throws<ArgumentException>(delegate { testCaseFactory.Instantiate(sutXml, ctrXml); }); }