public void TestGet() { IDatabase database = connectionRedis.GetDatabase(); database.Set("customer:" + customer.Id, customer); Customer customerGet = database.Get <Customer>("customer:" + customer.Id); Assert.AreEqual(customer.ToString(), customerGet.ToString()); }
public void TestHashGet() { IDatabase database = connectionRedis.GetDatabase(); database.HashSet("customer", customer.Id.ToString(), customer); Customer customerGet = database.HashGet <Customer>("customer", customer.Id.ToString()); Assert.AreEqual(customer.ToString(), customerGet.ToString()); database.HashDelete("customer", customer.Id.ToString()); }
public void TestHashGetAll() { IDatabase database = connectionRedis.GetDatabase(); database.HashSet("customer", customer.Id.ToString(), customer); var allHashes = database.HashGetAll <Customer>("customer"); Customer customerGet = null; allHashes.TryGetValue("12", out customerGet); Assert.AreEqual(customer.ToString(), customerGet.ToString()); database.HashDelete("customer", customer.Id.ToString()); }
public void TestGetSet() { //set Customer IDatabase database = connectionRedis.GetDatabase(); database.Set("customer:" + customer.Id, customer); //get Customer Customer customerGet = database.Get <Customer>("customer:" + customer.Id); Assert.AreEqual(customer.ToString(), customerGet.ToString()); //create a New Customer Customer newCustomer = new Customer(); newCustomer.Id = 13; newCustomer.Age = 25; newCustomer.Name = "New Customer"; //set New Customer and get Old Customer customerGet = database.GetSet <Customer>("customer:" + customer.Id, newCustomer); Assert.AreEqual(customer.ToString(), customerGet.ToString()); //get New Customer customerGet = database.Get <Customer>("customer:" + customer.Id); Assert.AreEqual(newCustomer.ToString(), customerGet.ToString()); }
public void TestGetSet() { //set Customer IDatabase database = connectionRedis.GetDatabase(); database.Set("customer:" + customer.Id, customer); //get Customer Customer customerGet = database.Get<Customer>("customer:" + customer.Id); Assert.AreEqual(customer.ToString(), customerGet.ToString()); //create a New Customer Customer newCustomer = new Customer(); newCustomer.Id = 13; newCustomer.Age = 25; newCustomer.Name = "New Customer"; //set New Customer and get Old Customer customerGet = database.GetSet<Customer>("customer:" + customer.Id, newCustomer); Assert.AreEqual(customer.ToString(), customerGet.ToString()); //get New Customer customerGet = database.Get<Customer>("customer:" + customer.Id); Assert.AreEqual(newCustomer.ToString(), customerGet.ToString()); }