예제 #1
0
        public void Fixture_ProducesCorrect_YamlObj()
        {
            var yamlObj  = YamlTestFixtureIO.Serialize(Fixture);
            var children = yamlObj.ToArray();

            Assert.AreEqual(7, children.Length, "6 Childs. Name + 5 scripts");
            Assert.AreEqual(guid.ToString(), children[0].value.value, "Guids missmatched");
            Assert.AreEqual("TestName", children[1].value.value, "Names missmatched");
            Assert.AreEqual("LightScript", children[2].value.property, "Script type missmatched");
        }
예제 #2
0
        public void Fixture_ProducesCorrect_YamlString()
        {
            var yamlObj    = YamlTestFixtureIO.Serialize(Fixture);
            var yamlString = YamlSerializer.SerializeYamlTree(yamlObj);

            // Needed to ignore randomly generated guids
            var expected = Regex.Replace(serializedFixture, RegexExpression.Guid, new Guid().ToString(), RegexOptions.Multiline | RegexOptions.IgnoreCase);
            var actual   = Regex.Replace(yamlString, RegexExpression.Guid, new Guid().ToString(), RegexOptions.Multiline | RegexOptions.IgnoreCase);

            StringAssert.Contains(actual, expected, "Strings missmatched.");
        }
예제 #3
0
        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.");
        }
예제 #4
0
        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.");
        }