Skip to content

Commit

Permalink
fixes #2607: The ConstantNode from CollectionConstantNode returns typ…
Browse files Browse the repository at this point in the history
…e full name in LiteralText property (#2609)

* fixes #2607: The ConstantNode from CollectionConstantNode returns type full name in LiteralText property

* update the base line
  • Loading branch information
xuzhg authored Feb 1, 2023
1 parent 3ca5b81 commit 12c18fc
Show file tree
Hide file tree
Showing 10 changed files with 40 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@

override Microsoft.OData.ODataEnumValue.ToString() -> string
override Microsoft.OData.ODataPrimitiveValue.ToString() -> string
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@

override Microsoft.OData.ODataEnumValue.ToString() -> string
override Microsoft.OData.ODataPrimitiveValue.ToString() -> string
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@

override Microsoft.OData.ODataEnumValue.ToString() -> string
override Microsoft.OData.ODataPrimitiveValue.ToString() -> string
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@

override Microsoft.OData.ODataEnumValue.ToString() -> string
override Microsoft.OData.ODataPrimitiveValue.ToString() -> string
9 changes: 9 additions & 0 deletions src/Microsoft.OData.Core/Value/ODataEnumValue.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,14 @@ public ODataEnumValue(string value, string typeName)

/// <summary>Get the type name in edm model.</summary>
public string TypeName { get; private set; }

/// <summary>
/// Returns a string that represents the current enum.
/// </summary>
/// <returns>A string that represents the current enum.</returns>
public override string ToString()
{
return Value;
}
}
}
9 changes: 9 additions & 0 deletions src/Microsoft.OData.Core/Value/ODataPrimitiveValue.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,5 +39,14 @@ public ODataPrimitiveValue(object value)
/// </summary>
/// <value> The underlying primitive CLR value. </value>
public object Value { get; private set; }

/// <summary>
/// Returns a string that represents the current primitve.
/// </summary>
/// <returns>A string that represents the current primitve.</returns>
public override string ToString()
{
return Value.ToString();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ public void SingleEnumToODataValue()
{
var enumValue = Feature.Feature1.ToODataValue() as ODataEnumValue;
Assert.Equal("Feature1", enumValue.Value);

Assert.Equal("Feature1", enumValue.ToString());
}

[Fact]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5323,6 +5323,8 @@ public sealed class Microsoft.OData.ODataEnumValue : Microsoft.OData.ODataValue

string TypeName { public get; }
string Value { public get; }

public virtual string ToString ()
}

[
Expand Down Expand Up @@ -5658,6 +5660,8 @@ public sealed class Microsoft.OData.ODataPrimitiveValue : Microsoft.OData.ODataV
public ODataPrimitiveValue (object value)

object Value { public get; }

public virtual string ToString ()
}

public sealed class Microsoft.OData.ODataProperty : Microsoft.OData.ODataPropertyInfo {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5323,6 +5323,8 @@ public sealed class Microsoft.OData.ODataEnumValue : Microsoft.OData.ODataValue

string TypeName { public get; }
string Value { public get; }

public virtual string ToString ()
}

[
Expand Down Expand Up @@ -5658,6 +5660,8 @@ public sealed class Microsoft.OData.ODataPrimitiveValue : Microsoft.OData.ODataV
public ODataPrimitiveValue (object value)

object Value { public get; }

public virtual string ToString ()
}

public sealed class Microsoft.OData.ODataProperty : Microsoft.OData.ODataPropertyInfo {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5323,6 +5323,8 @@ public sealed class Microsoft.OData.ODataEnumValue : Microsoft.OData.ODataValue

string TypeName { public get; }
string Value { public get; }

public virtual string ToString ()
}

[
Expand Down Expand Up @@ -5658,6 +5660,8 @@ public sealed class Microsoft.OData.ODataPrimitiveValue : Microsoft.OData.ODataV
public ODataPrimitiveValue (object value)

object Value { public get; }

public virtual string ToString ()
}

public sealed class Microsoft.OData.ODataProperty : Microsoft.OData.ODataPropertyInfo {
Expand Down

0 comments on commit 12c18fc

Please sign in to comment.