Beispiel #1
0
        public void FixtureClassesDoTableTest()
        {
            var expected = new List <string>
            {
                "|report:Namespace|report:Class|report:Parameters|report:Supports Table Type|report:Documentation|",
                "|report:Test Assembly With Documentation Attribute|report:Class Not Supporting Decision Table|report:|report:Script|report:|",
                "|report:Test Assembly With Documentation Attribute|report:Deprecated Class|report:|report:Decision, Script|report:[Deprecated class: Use Public Class instead]A deprecated class|",
                "|report:Test Assembly With Documentation Attribute|report:Deprecated Class|report:parameter: String[,]|report:Decision, Script|report:[Deprecated class: Use Public Class instead]Documentation for constructor with one parameter. Params: { parameter: documentation for the parameter }. Documentation attribute for constructor with 1 parameter|",
                "|report:Test Assembly With Documentation Attribute|report:Public Class|report:input: Int32|report:Decision, Query, Script|report:Just a demo public class constructor with one parameter. Documentation attribute for public class constructor with one parameter|",
                "|report:Test Assembly With Documentation Attribute|report:Public Class|report:input1: Int32, input2: Nullable<Int32>|report:Decision, Query, Script|report:Just a demo public class constructor with two parameters. Params: { input1: input 1 doc; input2: input 2 doc }. Documentation attribute for public class constructor with two parameters|",
                "|report:Test Assembly With Documentation Attribute|report:Wrong Table Class|report:|report:Decision, Script|report:WrongTableClass is a fixture with a wrong Table or Query Signature, so should not be recognized as table. Class with a wrong Table/Query signature, so only supports Script and Decision|"
            };
            var publicClass = new PublicClass(5);
            var location    = Assembly.GetAssembly(typeof(PublicClass)).Location;
            // forcing use of the abstract DoTable function, which should delegate to the subclass
            TableTypeFixture fixture = new FixtureClasses(location);
            var result = fixture.DoTable(null);

            var expectedIndex = 0;

            foreach (List <string> row in result)
            {
                var line      = expected[expectedIndex];
                var rowString = row.Aggregate("|", (current, cell) => current + cell + "|");
                Assert.AreEqual(line, rowString, $"Row {expectedIndex}");
                expectedIndex++;
            }
        }
Beispiel #2
0
        FixtureClass GetFixture(string token, ref string error, ref bool exclude)
        {
            exclude = token[0] == '-' ? true : false;

            string s = null;

            if (exclude && token.Length == 1)
            {
                error = "Invalid Fixture: " + token[0];
                return(null);
            }
            else
            {
                s = exclude ? token.Substring(1) : token;
            }

            FixtureClass fixtureClass = FixtureClasses.GetByName(s);

            if (fixtureClass == null)
            {
                fixtureClass = FixtureClasses.GetByShortName(s);
            }
            if (fixtureClass == null)
            {
                fixtureClass = FixtureClasses.GetByCharacter(s);
            }

            return(fixtureClass);
        }
Beispiel #3
0
        public void FixtureClassesSupportedTableTest3()
        {
            var list         = FixtureClasses.SupportedTables(typeof(TableTypeFixture));
            var expectedList = new List <string> {
                "Script", "Table"
            };

            Assert.IsTrue(expectedList.SequenceEqual(list));
        }
Beispiel #4
0
        public void FixtureClassesSupportedTableTest2()
        {
            var list         = FixtureClasses.SupportedTables(typeof(WrongTableClass));
            var expectedList = new List <string> {
                "Decision", "Script"
            };

            Assert.IsTrue(expectedList.SequenceEqual(list));
            Assert.IsFalse(FixtureClasses.SupportedTables(typeof(TableTypeFixture)).Contains("Query"));
        }
        public void ValidateMapAttribute()
        {
            var data = new FixtureClasses().GetInstanceDtoPublic();

            var property = data.GetType().GetProperty("SecondProperty");

            var attribute = property.GetCustomAttribute<MapAttribute>();

            Assert.IsNotNull(attribute);
            Assert.IsNotNullOrEmpty(attribute.NameProperty);
        }