public void ExecuteStoreJson_AddExistingId_Fails() { // Arrange var client = new FakeCouchbaseClient(); var instance = new MyTestType { Id1 = Guid.NewGuid(), Id2 = null }; var firstInstance = new MyTestType { Id1 = Guid.NewGuid(), Id2 = null }; client.ExecuteStoreJson(StoreMode.Add, "my_key", firstInstance); // Act var result = client.ExecuteStoreJson(StoreMode.Add, "my_key", instance); // Assert Assert.That(result.Success, Is.False); Assert.That(result.StatusCode, Is.EqualTo((int)StatusCode.KeyExists)); var value = client.GetJson <MyTestType>("my_key"); Assert.That(value, Is.EqualTo(firstInstance)); }
public void ExecuteGetJson_ExistingItem_GetsTheValue() { // Arrange var client = new FakeCouchbaseClient(); var instance = new MyTestType { Id1 = Guid.NewGuid(), Id2 = null }; client.ExecuteStoreJson(StoreMode.Add, "my_key", instance); // Act var result = client.ExecuteGetJson<MyTestType>("my_key"); // Assert Assert.That(result.Success, Is.True); Assert.That(result.StatusCode, Is.EqualTo((int)StatusCode.Success)); Assert.That(result.Value, Is.EqualTo(instance)); }
public void ExecuteGetJson_ExistingItem_GetsTheValue() { // Arrange var client = new FakeCouchbaseClient(); var instance = new MyTestType { Id1 = Guid.NewGuid(), Id2 = null }; client.ExecuteStoreJson(StoreMode.Add, "my_key", instance); // Act var result = client.ExecuteGetJson <MyTestType>("my_key"); // Assert Assert.That(result.Success, Is.True); Assert.That(result.StatusCode, Is.EqualTo((int)StatusCode.Success)); Assert.That(result.Value, Is.EqualTo(instance)); }
public void ExecuteStoreJson_Add_StoresTheValue() { // Arrange var client = new FakeCouchbaseClient(); var instance = new MyTestType { Id1 = Guid.NewGuid(), Id2 = null }; // Act var result = client.ExecuteStoreJson(StoreMode.Add, instance.Id1.ToString(), instance); // Assert Assert.That(result.Success, Is.True); Assert.That(result.StatusCode, Is.EqualTo((int)StatusCode.Success)); var value = client.GetJson <MyTestType>(instance.Id1.ToString()); Assert.That(value, Is.EqualTo(instance)); }
public void ExecuteStoreJson_AddExistingId_Fails() { // Arrange var client = new FakeCouchbaseClient(); var instance = new MyTestType { Id1 = Guid.NewGuid(), Id2 = null }; var firstInstance = new MyTestType { Id1 = Guid.NewGuid(), Id2 = null }; client.ExecuteStoreJson(StoreMode.Add, "my_key", firstInstance); // Act var result = client.ExecuteStoreJson(StoreMode.Add, "my_key", instance); // Assert Assert.That(result.Success, Is.False); Assert.That(result.StatusCode, Is.EqualTo((int)StatusCode.KeyExists)); var value = client.GetJson<MyTestType>("my_key"); Assert.That(value, Is.EqualTo(firstInstance)); }
public void ExecuteStoreJson_Add_StoresTheValue() { // Arrange var client = new FakeCouchbaseClient(); var instance = new MyTestType {Id1 = Guid.NewGuid(), Id2 = null}; // Act var result = client.ExecuteStoreJson(StoreMode.Add, instance.Id1.ToString(), instance); // Assert Assert.That(result.Success,Is.True); Assert.That(result.StatusCode,Is.EqualTo((int) StatusCode.Success)); var value = client.GetJson<MyTestType>(instance.Id1.ToString()); Assert.That(value,Is.EqualTo(instance)); }