public void UsingStreams() { ResponseCache.Clear(); string errorListLocation = Constants.ErrorList; Constants.ErrorList = "/ErrorListNotExpired.xml.aspx"; ErrorList errorList = EveApi.GetErrorList(); using (Stream s = new FileStream("ResponseCache.xml", FileMode.Create)) { ResponseCache.Save(s); } ResponseCache.Clear(); using (Stream s = new FileStream("ResponseCache.xml", FileMode.Open)) { ResponseCache.Load(s); } ErrorList cached = EveApi.GetErrorList(); Assert.AreEqual(errorList.CachedUntilLocal, cached.CachedUntilLocal); Assert.AreEqual(false, errorList.FromCache); Assert.AreEqual(true, cached.FromCache); Constants.ErrorList = errorListLocation; }
public void GetErrorList() { ResponseCache.Clear(); ErrorList errorList = EveApi.GetErrorList(); Assert.AreEqual("Expected before ref/trans ID = 0: wallet not previously loaded.", errorList.GetMessageForErrorCode("100")); Assert.AreEqual("Current security level not high enough.", errorList.GetMessageForErrorCode("200")); Assert.AreEqual("User forced test error condition.", errorList.GetMessageForErrorCode("999")); }
public void ExpiredApiResponse() { ResponseCache.Clear(); string errorListLocation = Constants.ErrorList; Constants.ErrorList = "/ErrorListExpired.xml.aspx"; ErrorList errorList = EveApi.GetErrorList(); ErrorList errorList2 = EveApi.GetErrorList(); Assert.AreEqual(false, errorList.FromCache); Assert.AreEqual(false, errorList2.FromCache); Constants.ErrorList = errorListLocation; }
public void ErrorListPersist() { ResponseCache.Clear(); ErrorList errorList = EveApi.GetErrorList(); ResponseCache.Save("ResponseCache.xml"); ResponseCache.Clear(); ResponseCache.Load("ResponseCache.xml"); ErrorList cachedErrorList = EveApi.GetErrorList(); Assert.AreEqual(errorList.CachedUntilLocal, cachedErrorList.CachedUntilLocal); Assert.AreEqual(errorList.GetMessageForErrorCode("100"), cachedErrorList.GetMessageForErrorCode("100")); Assert.AreEqual(errorList.GetMessageForErrorCode("200"), cachedErrorList.GetMessageForErrorCode("200")); Assert.AreEqual(errorList.GetMessageForErrorCode("999"), cachedErrorList.GetMessageForErrorCode("999")); }
public static void ErrorListExample() { ErrorList errorList = EveApi.GetErrorList(); Console.WriteLine("{0}", errorList.GetMessageForErrorCode("100")); }