public void YamlString_ProducesCorrect_Fixture() { var f = Fixture; var yamlObj = YamlTestFixtureIO.Serialize(f); var text = YamlSerializer.SerializeYamlTree(yamlObj); var newObj = YamlSerializer.DeserializeYamlTree(text); var newFixture = YamlTestFixtureIO.Deserialize(newObj); Assert.AreEqual(f.Name, newFixture.Name, "Fixture names missmatched."); Assert.AreEqual(f.Tests.Count(), newFixture.Tests.Count(), "Test count should be the same."); Assert.AreEqual(f.Setup.Name, newFixture.Setup.Name, "Setup names should be equal."); Assert.AreEqual(f.Setup.Commands.Count(), newFixture.Setup.Commands.Count(), "Setup command count should be the same."); }
public void YamlObject_ProducesCorrect_Fixture() { var f = Fixture; var yamlObj = YamlTestFixtureIO.Serialize(f); var newFixture = YamlTestFixtureIO.Deserialize(yamlObj); Assert.AreEqual(f.Name, newFixture.Name, "Fixture names missmatched."); Assert.AreEqual(f.Tests.Count(), newFixture.Tests.Count(), "Test count should be the same."); Assert.AreEqual(f.Setup.Name, newFixture.Setup.Name, "Setup names should be equal."); Assert.AreEqual(f.Setup.Commands.Count(), newFixture.Setup.Commands.Count(), "Setup command count should be the same."); var yamlObj2 = YamlTestFixtureIO.Serialize(newFixture); var text = YamlSerializer.SerializeYamlTree(yamlObj2); // Needed to ignore randomly generated guids var expected = Regex.Replace(text, RegexExpression.Guid, new Guid().ToString(), RegexOptions.Multiline | RegexOptions.IgnoreCase); var actual = Regex.Replace(serializedFixture, RegexExpression.Guid, new Guid().ToString(), RegexOptions.Multiline | RegexOptions.IgnoreCase); StringAssert.Contains(actual, expected, "Strings missmatched."); }