public void TestNullResponse() { APIResponseFactory responseFactory = APIResponseFactory.GetInstance(); HttpWebResponse response = (HttpWebResponse)null; IAPIResponse ApiResponse = responseFactory.PackageAPIResponse(response); Assert.IsNotNull(ApiResponse); Assert.IsTrue(ApiResponse.Status.GetStatus() == ResponseStatus.Status.CriticallyInvalid); }
public void TestInvalidResponse() { APIResponseFactory responseFactory = APIResponseFactory.GetInstance(); WebRequest request = WebRequest.Create("http://stackoverflow.com"); HttpWebResponse response = (HttpWebResponse)request.GetResponse(); IAPIResponse ApiResponse = responseFactory.PackageAPIResponse(response); Assert.IsNotNull(ApiResponse); Assert.IsTrue(ApiResponse.Status.GetStatus() == ResponseStatus.Status.Unknown); }