Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions Microsoft.Azure.Cosmos/src/PartitionKey.cs
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,11 @@ public bool Equals(PartitionKey other)
/// <returns>The string representation of the partition key value</returns>
public override string ToString()
{
if (this.IsNone)
{
return "None";
}

if (this.InternalKey == null)
{
return PartitionKey.NullPartitionKeyInternal.ToJsonString();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,15 @@ public void TestPartitionKeyDefinitionAreEquivalent()
Assert.IsTrue(PartitionKeyDefinition.AreEquivalent(definition1, definition2));
}

[TestMethod]
public void NoneToStringNotNullRef()
{
const string noneString = "None";
Cosmos.PartitionKey noneKey = Cosmos.PartitionKey.None;

Assert.AreEqual(noneString, noneKey.ToString());
}

[TestMethod]
public void RoundTripTests()
{
Expand Down