public void Initialize() { connectionRedis = ConnectionMultiplexer.Connect("localhost:13919,password=senhadoredis"); customer = new Customer(); customer.Id = 12; customer.Age = 30; customer.Name = "Customer"; }
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()); }