Esempio n. 1
0
        public void ExecuteStore_AddingExistingItem_ReturnsFailure()
        {
            // Arrange
            var client = new FakeCouchbaseClient();

            client.ExecuteStore(StoreMode.Add, "my_key", "some_value");

            // Act
            var result = client.ExecuteStore(StoreMode.Add, "my_key", "some other value");

            // Assert
            Assert.That(result.Success, Is.False);
            Assert.That(result.StatusCode, Is.EqualTo((int)StatusCode.KeyExists));
        }
Esempio n. 2
0
        public void ExecuteStore_ReplaceExisting_ReturnsSuccess()
        {
            // Arrange
            var client = new FakeCouchbaseClient();

            client.ExecuteStore(StoreMode.Add, "my_key", "some_value");

            // Act
            var result = client.ExecuteStore(StoreMode.Replace, "my_key", "some other value");

            // Assert
            Assert.That(result.Success, Is.True);
            Assert.That(result.StatusCode, Is.EqualTo((int)StatusCode.Success));
        }
Esempio n. 3
0
        public void Get_Keys_ReturnsMatchingKeys()
        {
            // Arrange
            var client = new FakeCouchbaseClient();

            client.ExecuteStore(StoreMode.Add, "key1", "my_value1");
            client.ExecuteStore(StoreMode.Add, "key2", "my_value2");
            client.ExecuteStore(StoreMode.Add, "key3", "my_value3");

            // Act
            var result = client.Get(new[] { "key1", "key3" });

            // Assert
            Assert.That(result.Count, Is.EqualTo(2));
            Assert.That(result["key1"], Is.EqualTo("my_value1"));
            Assert.That(result["key3"], Is.EqualTo("my_value3"));
        }
Esempio n. 4
0
        public void ExecuteStore_ReplaceNoExisting_ReturnsFailure()
        {
            // Arrange
            var client = new FakeCouchbaseClient();

            // Act
            var result = client.ExecuteStore(StoreMode.Replace, "my_key", "some_value");

            // Assert
            Assert.That(result.Success, Is.False);
            Assert.That(result.StatusCode, Is.EqualTo((int)StatusCode.KeyNotFound));
        }
        public void Get_Keys_ReturnsMatchingKeys()
        {
            // Arrange
            var client = new FakeCouchbaseClient();

            client.ExecuteStore(StoreMode.Add, "key1", "my_value1");
            client.ExecuteStore(StoreMode.Add, "key2", "my_value2");
            client.ExecuteStore(StoreMode.Add, "key3", "my_value3");

            // Act
            var result = client.Get(new[] {"key1", "key3"});

            // Assert
            Assert.That(result.Count,Is.EqualTo(2));
            Assert.That(result["key1"],Is.EqualTo("my_value1"));
            Assert.That(result["key3"],Is.EqualTo("my_value3"));
        }
        public void ExecuteStore_Set_ReturnsSuccess()
        {
            // Arrange
            var client = new FakeCouchbaseClient();

            // Act
            var result = client.ExecuteStore(StoreMode.Set, "my_key", "some_value");

            // Assert
            Assert.That(result.Success,Is.True);
            Assert.That(result.StatusCode,Is.EqualTo((int) StatusCode.Success));
        }
        public void ExecuteStore_ReplaceNoExisting_ReturnsFailure()
        {
            // Arrange
            var client = new FakeCouchbaseClient();

            // Act
            var result = client.ExecuteStore(StoreMode.Replace, "my_key", "some_value");

            // Assert
            Assert.That(result.Success, Is.False);
            Assert.That(result.StatusCode, Is.EqualTo((int)StatusCode.KeyNotFound));
        }
        public void ExecuteStore_AddingExistingItem_ReturnsFailure()
        {
            // Arrange
            var client = new FakeCouchbaseClient();

            client.ExecuteStore(StoreMode.Add, "my_key", "some_value");

            // Act
            var result = client.ExecuteStore(StoreMode.Add, "my_key", "some other value");

            // Assert
            Assert.That(result.Success, Is.False);
            Assert.That(result.StatusCode, Is.EqualTo((int)StatusCode.KeyExists));
        }