public void Serialize_DataTypeXml_NoDefaultAndSettings() { var columnXml = new ColumnXml(); columnXml.Caption = "My Caption"; columnXml.Perspective = "My Schema"; columnXml.Default = new DefaultXml() { ApplyTo = SettingsXml.DefaultScope.Assert, ConnectionString = "connStr" }; columnXml.Settings = new SettingsXml() { References = new List<ReferenceXml>() { new ReferenceXml() { Name = "Bob", ConnectionString = "connStr" } } }; var dataTypeXml = new DataTypeXml() { Item = columnXml }; var serializer = new XmlSerializer(typeof(DataTypeXml)); var stream = new MemoryStream(); var writer = new StreamWriter(stream, Encoding.UTF8); serializer.Serialize(writer, dataTypeXml); var content = Encoding.UTF8.GetString(stream.ToArray()); writer.Close(); stream.Close(); Debug.WriteLine(content); Assert.That(content, Is.StringContaining("<column")); Assert.That(content, Is.StringContaining("caption=\"My Caption\"")); Assert.That(content, Is.StringContaining("perspective=\"My Schema\"")); Assert.That(content, Is.Not.StringContaining("efault")); Assert.That(content, Is.Not.StringContaining("eference")); }
protected override void BaseSetup(AbstractSystemUnderTestXml sutXml, AbstractConstraintXml ctrXml) { if (!(sutXml is DataTypeXml)) throw new ArgumentException("System-under-test must be a 'DataTypeXml'"); SystemUnderTestXml = (DataTypeXml)sutXml; }
protected NBiConstraint InstantiateConstraint(IsXml ctrXml, DataTypeXml sutXml) { var expected = ctrXml.Value; var ctr = new IsConstraint(expected); return ctr; }
public void Instantiate_DataTypeIs_TestCase() { var sutXml = new DataTypeXml(); var ctrXml = new IsXml(); 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 RelationalCommand(new SqlCommand(), null, null)); builderMockFactory.Setup(b => b.GetConstraint()).Returns(new IsConstraint("x")); var builder = builderMockFactory.Object; var testCaseFactory = new TestCaseFactory(); testCaseFactory.Register(typeof(DataTypeXml), typeof(IsXml), builder); var tc = testCaseFactory.Instantiate(sutXml, ctrXml); Assert.That(tc, Is.Not.Null); builderMockFactory.VerifyAll(); }
protected virtual object InstantiateSystemUnderTest(DataTypeXml sutXml) { return InstantiateCommand(sutXml.Item); }
public void IsHandling_DataTypeIs_True() { var sutXml = new DataTypeXml(); var ctrXml = new IsXml(); var testCaseFactory = new TestCaseFactory(); var actual = testCaseFactory.IsHandling(sutXml.GetType(), ctrXml.GetType()); Assert.That(actual, Is.True); }