public void Get_Multiple_Positive_Test() { Debug.WriteLine("-------------Get_Multiple_Positive_Test()------------"); string[] keys = new string[10]; using (CalcTimeSpan calc = new CalcTimeSpan("Time for Setting")) { for (int i = 0; i < 10; i++) { DistCache.Add(i.ToString(), i * 2); keys[i] = i.ToString(); } } using (CalcTimeSpan calc = new CalcTimeSpan("Time for Getting")) { IDictionary <string, object> _retVal = DistCache.Get(keys); for (int i = 0; i < 10; i++) { Assert.IsTrue(((int)_retVal[keys[i]]) == (i * 2)); } } }
public void GetDefaultExpireTime_Positive_Test() { using (CalcTimeSpan calc = new CalcTimeSpan("Time for setting")) { long lDefaulttime = DistCache.DefaultExpireTime; Debug.WriteLine("Default Expire Time: " + lDefaulttime); Assert.IsTrue(lDefaulttime == 2000); } }
public void CheckExpire_Max_Positive_Test() { Debug.WriteLine("-------------CheckExpire_Max_Positive_Test()------------"); string strKey = "name"; string strValue = "Fahad"; using (CalcTimeSpan calc = new CalcTimeSpan("Time for Setting")) { Assert.IsTrue(DistCache.Add(strKey, strValue)); } System.Threading.Thread.Sleep(new TimeSpan(0, 0, 5)); using (CalcTimeSpan calc = new CalcTimeSpan("Time for Getting")) { Assert.IsNotNull(DistCache.Get(strKey)); } }
public void Get_Template_Positive_Test() { Debug.WriteLine("-------------Get_Template_Positive_Test()------------"); string strKey = "firstname"; string strValue = "Fahad"; string strReturned = string.Empty; using (CalcTimeSpan calc = new CalcTimeSpan("Time for Setting")) { Assert.IsTrue(DistCache.Add(strKey, strValue), "Error adding value"); } using (CalcTimeSpan calc = new CalcTimeSpan("Time for Getting")) { strReturned = DistCache.Get <string>(strKey); } Assert.IsTrue(strValue.Equals(strReturned), string.Format("Not the same: {0}", strReturned)); }
public void Add_String_Positive_Test() { Debug.WriteLine("-------------Add_String_Positive_Test()------------"); string strKey = "firstname"; string strValue = "Fahad"; string strReturned = string.Empty; using (CalcTimeSpan calc = new CalcTimeSpan("Time for Setting")) { Assert.IsTrue(DistCache.Add(strKey, strValue),"Error adding value"); } Debug.WriteLine("-------------------"); using (CalcTimeSpan calc = new CalcTimeSpan("Time for Getting")) { strReturned = DistCache.Get(strKey) as string; } Debug.WriteLine("Returned: "+ (strReturned == null)); Assert.IsTrue(strValue.Equals(strReturned),string.Format("Not the same: {0}",strReturned)); }
public void Get_Multiple_Positive_Test() { Debug.WriteLine("-------------Get_Multiple_Positive_Test()------------"); string[] keys = new string[10]; using (CalcTimeSpan calc = new CalcTimeSpan("Time for Setting")) { for (int i = 0; i < 10; i++) { DistCache.Add(i.ToString(), i * 2); keys[i] = i.ToString(); } } using (CalcTimeSpan calc = new CalcTimeSpan("Time for Getting")) { IDictionary<string, object> _retVal = DistCache.Get(keys); for (int i = 0; i < 10; i++) { Assert.IsTrue( ((int)_retVal[keys[i]]) == (i * 2)); } } }
public void GetDefaultExpireTime_Positive_Test() { using (CalcTimeSpan calc = new CalcTimeSpan("Time for setting")) { long lDefaulttime = DistCache.DefaultExpireTime; Debug.WriteLine("Default Expire Time: "+lDefaulttime); Assert.IsTrue(lDefaulttime==2000); } }
public void CheckExpire_Max_Positive_Test() { Debug.WriteLine("-------------CheckExpire_Max_Positive_Test()------------"); string strKey = "name"; string strValue = "Fahad"; using (CalcTimeSpan calc = new CalcTimeSpan("Time for Setting")) { Assert.IsTrue(DistCache.Add(strKey, strValue)); } System.Threading.Thread.Sleep(new TimeSpan(0,0,5)); using (CalcTimeSpan calc = new CalcTimeSpan("Time for Getting")) { Assert.IsNotNull(DistCache.Get(strKey)); } }