public void CallSiteKindSerialization()
        {
            const CallSiteKind obj  = CallSiteKind.RECEIVER;
            const string       json = "\"RECEIVER\"";

            var actualJson = obj.ToFormattedJson();

            Assert.AreEqual(json, actualJson);
            var other = json.ParseJsonTo <CallSiteKind>();

            Assert.AreEqual(obj, other);
        }
Beispiel #2
0
        public AddedParameter(
            ITypeSymbol type,
            string typeName,
            string name,
            CallSiteKind callSiteKind,
            string callSiteValue = "",
            bool isRequired      = true,
            string defaultValue  = "",
            bool typeBinds       = true
            )
        {
            Type          = type;
            TypeBinds     = typeBinds;
            TypeName      = typeName;
            Name          = name;
            CallSiteValue = callSiteValue;

            IsRequired   = isRequired;
            DefaultValue = defaultValue;
            CallSiteKind = callSiteKind;

            // Populate the call site text for the UI
            switch (CallSiteKind)
            {
            case CallSiteKind.Value:
            case CallSiteKind.ValueWithName:
                CallSiteValue = callSiteValue;
                break;

            case CallSiteKind.Todo:
                CallSiteValue =
                    FeaturesResources.ChangeSignature_NewParameterIntroduceTODOVariable;
                break;

            case CallSiteKind.Omitted:
                CallSiteValue = FeaturesResources.ChangeSignature_NewParameterOmitValue;
                break;

            case CallSiteKind.Inferred:
                CallSiteValue = FeaturesResources.ChangeSignature_NewParameterInferValue;
                break;

            default:
                throw ExceptionUtilities.Unreachable;
            }
        }
Beispiel #3
0
        internal static AddedParameterOrExistingIndex CreateAdded(
            string fullTypeName,
            string parameterName,
            CallSiteKind callSiteKind,
            string callSiteValue = "",
            bool isRequired      = true,
            string defaultValue  = "",
            bool typeBinds       = true)
        {
            var parameter = new AddedParameter(
                type: null !,     // Filled in later based on the fullTypeName
                typeName: null !, // Not needed for engine testing
                parameterName,
                callSiteKind,
                callSiteValue,
                isRequired,
                defaultValue,
                typeBinds);

            return(new AddedParameterOrExistingIndex(parameter, fullTypeName));
        }