Пример #1
0
    static void generates(Type[] types, string[] expectedLookupNames, string[] expectedLookupCodes)
    {
        var infos = TypeReflectionProvider.GetComponentInfos(types);

        var files = new ComponentIndicesGenerator().Generate(infos);

        files.Length.should_be(expectedLookupNames.Length);

        for (int i = 0; i < expectedLookupNames.Length; i++)
        {
            var expectedLookupName = expectedLookupNames[i];
            var expectedLookupCode = expectedLookupCodes[i].ToUnixLineEndings();

            files.Any(f => f.fileName == expectedLookupName).should_be_true();
            var file = files.Single(f => f.fileName == expectedLookupName);
#pragma warning disable
            if (logResults)
            {
                Console.WriteLine("should:\n" + expectedLookupCode);
                Console.WriteLine("was:\n" + file.fileContent);
            }

            file.fileContent.should_be(expectedLookupCode);
        }
    }
    static void generatesEmptyLookup(string[] poolNames, string[] lookupNames, string[] lookupCodes)
    {
        var files = new ComponentIndicesGenerator().Generate(poolNames);

        files.Length.should_be(poolNames.Length == 0 ? 1 : poolNames.Length);

        for (int i = 0; i < lookupNames.Length; i++)
        {
            var lookupName         = lookupNames[i];
            var expectedLookupCode = lookupCodes[i].ToUnixLineEndings();
            files.Any(f => f.fileName == lookupName).should_be_true();
            var file = files.First(f => f.fileName == lookupName);
            if (logResults)
            {
                Console.WriteLine("should:\n" + expectedLookupCode);
                Console.WriteLine("was:\n" + file.fileContent);
            }
            file.fileContent.should_be(expectedLookupCode);
        }
    }