public void DoesntMatchFunctionsWithOneParameter()
        {
            var excelGivenClass = ExcelGivenClass(
                "Target",
                new GivenClassSimpleProperty("StringFunction", ExcelPropertyType.String)
                );

            var match = new ExcelCsharpClassMatcher(new ExcelCsharpPropertyMatcher()).Matches(
                typeof(ITarget),
                excelGivenClass);

            Assert.True(match.Matches);
            Assert.AreEqual(match.PercentMatchingProperties, 0);
        }
        public void MatchesAncestorProperties()
        {
            var excelGivenClass = ExcelGivenClass(
                "Target",
                new GivenClassSimpleProperty("AncestorIntegerProperty", ExcelPropertyType.Number)
                );

            var match = new ExcelCsharpClassMatcher(new ExcelCsharpPropertyMatcher()).Matches(
                typeof(ITarget),
                excelGivenClass);

            Assert.True(match.Matches);
            Assert.AreEqual(match.PercentMatchingProperties, 1);
        }
        public void MatchesIEnumerableSpecialCaseFloatProperties()
        {
            var excelGivenClass = ExcelGivenClass(
                "Target",
                new GivenClassComplexListProperty("IEnumerableFloatProperty", "Float")
                );

            var match = new ExcelCsharpClassMatcher(new ExcelCsharpPropertyMatcher()).Matches(
                typeof(ITarget),
                excelGivenClass);

            Assert.True(match.Matches);
            Assert.AreEqual(match.PercentMatchingProperties, 1);
        }
        public void MatchesComplexProperties()
        {
            var excelGivenClass = ExcelGivenClass(
                "Target",
                new GivenClassComplexProperty("ComplexProperty", "Target")
                );

            var match = new ExcelCsharpClassMatcher(new ExcelCsharpPropertyMatcher()).Matches(
                typeof(ITarget),
                excelGivenClass);

            Assert.True(match.Matches);
            Assert.AreEqual(match.PercentMatchingProperties, 1);
        }
        public void DoesntMatchesFunctionsWithMultipleParameters()
        {
            var excelGivenClass = ExcelGivenClass(
                "Target",
                new GivenClassSimpleProperty("FunctionWithTwoParameters", ExcelPropertyType.Number)
                );

            var match = new ExcelCsharpClassMatcher(new ExcelCsharpPropertyMatcher()).Matches(
                typeof(ITarget),
                excelGivenClass);

            Assert.True(match.Matches);
            Assert.AreEqual(match.PercentMatchingProperties, 0);
        }
Пример #6
0
        public InMemoryGenerateCSharpFromExcel(
            ILogger logger,
            IEnumerable <ITabularBook> workbooks,
            string projectRootNamespace,
            IEnumerable <string> usings,
            IEnumerable <Type> typesUnderTest,
            string assertionClassPrefix)
        {
            givenClassRecorder         = new GivenClassRecorder();
            excelCsharpPropertyMatcher = new ExcelCsharpPropertyMatcher();
            excelCsharpClassMatcher    = new ExcelCsharpClassMatcher(excelCsharpPropertyMatcher);

            this.logger               = logger;
            this.workbooks            = workbooks;
            this.projectRootNamespace = projectRootNamespace;
            this.usings               = usings;
            this.typesUnderTest       = typesUnderTest;
            this.assertionClassPrefix = assertionClassPrefix;

            generatedFiles = new List <CsharpProjectFileToSave>();
        }