Beispiel #1
0
        public void ShouldReturnExpectedIdentificationOfEnumWhenCalledMultipleTimes()
        {
            // Given
            ReadInteropTemplates.SetReadTemplates();
            var enumIdentifierString = "EnumExport";

            var sourceFile = "enum.ts";
            var source     = File.ReadAllText($"./SourceFiles/{sourceFile}");
            var ast        = new TypeScriptAST(source, sourceFile);

            // When
            var notCachedEnumIdentifier = new EnumTypeIdentifierCached();

            // First Identify
            notCachedEnumIdentifier.Identify(
                enumIdentifierString,
                ast
                ).Should() // Then
            .BeTrue();

            // Second Identify
            notCachedEnumIdentifier.Identify(
                enumIdentifierString,
                ast
                ).Should() // Then
            .BeTrue();
        }
        public void ShouldReturnExpectedIdentificationOfEnumWhenCalledMultipleTimesWithNodeJS()
        {
            // Given
            var enumIdentifierString = "EnumExport";

            var sourceFile = "enum.ts";
            var source     = File.ReadAllText($"./SourceFiles/{sourceFile}");
            var ast        = new NodeJS_ASTWrapper(source);

            // When
            var notCachedEnumIdentifier = new EnumTypeIdentifierCached();

            // First Identify
            notCachedEnumIdentifier.Identify(
                enumIdentifierString,
                ast
                ).Should() // Then
            .BeTrue();

            // Second Identify
            notCachedEnumIdentifier.Identify(
                enumIdentifierString,
                ast
                ).Should() // Then
            .BeTrue();
        }
        public void ShouldReturnExpectedIdentificationOfEnumWhenUsingCachedInstance()
        {
            // Given
            var expected             = true;
            var enumIdentifierString = "EnumExport";

            var sourceFile = "enum.ts";
            var source     = File.ReadAllText($"./SourceFiles/{sourceFile}");
            var ast        = new TypeScriptAST(source, sourceFile);

            // When
            var notCachedEnumIdentifier = new EnumTypeIdentifierCached();
            var actual = notCachedEnumIdentifier.Identify(
                enumIdentifierString,
                ast
                );

            // Then
            actual.Should()
            .Be(expected);
        }