예제 #1
0
        public void TestGetLegalCSharpIdentifier(string proposedName, string expectedName)
        {
            //-- act

            var actualName = SyntaxHelpers.GetValidCSharpIdentifier(proposedName);

            //-- assert

            actualName.Should().Be(expectedName);
        }
예제 #2
0
        //-----------------------------------------------------------------------------------------------------------------------------------------------------

        private TypeMember BuildArtifactTypeFor(TypeMember productType)
        {
            var key = productType.Generator.TypeKey.Value;
            var activationContract = productType.Generator.ActivationContract ?? typeof(object);

            var artifactType = new TypeMember(
                MemberVisibility.Public,
                TypeMemberKind.Class,
                SyntaxHelpers.GetValidCSharpIdentifier($"FactoryOf_{productType.FullName}"));

            artifactType.BaseType = new TypeMember(typeof(RuntimeTypeFactoryArtifact <>).MakeGenericType(activationContract));

            ImplementArtifactConstructor(productType, key, artifactType);
            ImplementActivationInterfaces(productType, activationContract, artifactType);

            return(artifactType);
        }