public void SetRangeInHash_SetsExpectedValues() { // GIVEN const string key = "key-1"; var hash = new Hash { Id = key, Hashes = new Dictionary <string, string> { { "hash-1", "value-1" }, { "hash-2", "value-2" } } }; _elasticClient.Index(hash, desc => desc.Refresh(Refresh.True)).ThrowIfInvalid(); // WHEN var newValues = new Dictionary <string, string> { { "hash-2", "value-2b" }, { "hash-3", "value-3" } }; _elasticConnection.SetRangeInHash(key, newValues); // THEN var actualHashes = _elasticClient.Get <Hash>(key).ThrowIfInvalid(); var expectedHashes = new Dictionary <string, string> { { "hash-1", "value-1" }, { "hash-2", "value-2b" }, { "hash-3", "value-3" } }; actualHashes.Source.Hashes.ShouldBeEquivalentTo(expectedHashes); }
public void SetRangeInHash_Throws() { // GIVEN WHEN THEN Assert.Throws <HangfireElasticSearchException>(() => _elasticConnection.SetRangeInHash("key", new List <KeyValuePair <string, string> >())); }