public void CalculateHashOfJsonFor_WhenItemsDifferent_ThenDifferentHash() { var obj1 = new TestClassItem { Key = "Schlüssel", Value = 32 }; var obj2 = new TestClassItem { Key = "Schlüssel", Value = 1 }; var obj3 = new TestClassItem { Key = "Tür", Value = 32 }; Assert.NotEqual( CosmosDbPartitionedItem <TestClassItem> .CalculateHashOfJsonFor(obj1), CosmosDbPartitionedItem <TestClassItem> .CalculateHashOfJsonFor(obj2) ); Assert.NotEqual( CosmosDbPartitionedItem <TestClassItem> .CalculateHashOfJsonFor(obj1), CosmosDbPartitionedItem <TestClassItem> .CalculateHashOfJsonFor(obj3) ); Assert.NotEqual( CosmosDbPartitionedItem <TestClassItem> .CalculateHashOfJsonFor(obj2), CosmosDbPartitionedItem <TestClassItem> .CalculateHashOfJsonFor(obj3) ); }
public void GetPartitionKeyValue() { var obj = new TestClassItem { Key = "Schlüssel", Value = 32 };; Assert.Equal(obj.Key, CosmosDbPartitionedItem <TestClassItem> .GetPartitionKeyValue(obj)); obj.Key = "Etwas Anderes"; Assert.Equal(obj.Key, CosmosDbPartitionedItem <TestClassItem> .GetPartitionKeyValue(obj)); }
public void CalculateHashOfJsonFor_WhenDifferenceIrrelevant_ThenSameHash() { var obj1 = new TestClassItem { Key = "Schlüssel", Value = 32, IrrelevantForHashCalculation = 1 }; var obj2 = new TestClassItem { Key = "Schlüssel", Value = 32, IrrelevantForHashCalculation = 100 }; Assert.Equal( CosmosDbPartitionedItem <TestClassItem> .CalculateHashOfJsonFor(obj1), CosmosDbPartitionedItem <TestClassItem> .CalculateHashOfJsonFor(obj2) ); }
public void CalculateHashOfJsonFor_WhenItemsEqual_ThenSameHash() { var obj1 = new TestClassItem { Key = "Schlüssel", Value = 32 }; var obj2 = new TestClassItem { Key = "Schlüssel", Value = 32 }; Assert.Equal( CosmosDbPartitionedItem <TestClassItem> .CalculateHashOfJsonFor(obj1), CosmosDbPartitionedItem <TestClassItem> .CalculateHashOfJsonFor(obj1) ); Assert.Equal( CosmosDbPartitionedItem <TestClassItem> .CalculateHashOfJsonFor(obj2), CosmosDbPartitionedItem <TestClassItem> .CalculateHashOfJsonFor(obj2) ); Assert.Equal( CosmosDbPartitionedItem <TestClassItem> .CalculateHashOfJsonFor(obj1), CosmosDbPartitionedItem <TestClassItem> .CalculateHashOfJsonFor(obj2) ); }