public static void AssertMethod(IAddToWebRequest addtowebrequest, string method) { var _mockrequest = new Mock <ICloudFilesRequest>(); addtowebrequest.Apply(_mockrequest.Object); _mockrequest.VerifySet(x => x.Method = method); }
public static Mock<ICloudFilesRequest> GetMock(IAddToWebRequest addtowebrequest) { var webresponse = new WebHeaderCollection(); var _mockrequest = new Mock<ICloudFilesRequest>(); _mockrequest.SetupGet(x => x.Headers).Returns(webresponse); addtowebrequest.Apply(_mockrequest.Object); return _mockrequest; }
public static void AssertHeaders(IAddToWebRequest addToWebRequest, string headerkey, object headervalue) { var webresponse = new WebHeaderCollection(); var _mockrequest = new Mock<ICloudFilesRequest>(); _mockrequest.SetupGet(x => x.Headers).Returns(webresponse); addToWebRequest.Apply(_mockrequest.Object); Assert.AreEqual(webresponse[headerkey], headervalue); }
public static Mock <ICloudFilesRequest> GetMock(IAddToWebRequest addtowebrequest) { var webresponse = new WebHeaderCollection(); var _mockrequest = new Mock <ICloudFilesRequest>(); _mockrequest.SetupGet(x => x.Headers).Returns(webresponse); addtowebrequest.Apply(_mockrequest.Object); return(_mockrequest); }
public static void AssertHeaders(IAddToWebRequest addToWebRequest, string headerkey, object headervalue) { var webresponse = new WebHeaderCollection(); var _mockrequest = new Mock <ICloudFilesRequest>(); _mockrequest.SetupGet(x => x.Headers).Returns(webresponse); addToWebRequest.Apply(_mockrequest.Object); Assert.AreEqual(webresponse[headerkey], headervalue); }
private ICloudFilesResponse commonSubmit(IAddToWebRequest requesttype, Func<ICloudFilesRequest> requeststrategy, string authtoken) { var cfrequest = requeststrategy.Invoke(); //only way I've figured out how to make auth header logic conditional, this is a smell and in need of a better pattern if (!String.IsNullOrEmpty(authtoken)) AddAuthHeaderToRequest(cfrequest, authtoken); requesttype.Apply(cfrequest); var response = _responsefactory.Create(cfrequest); return response; }
private ICloudFilesResponse commonSubmit(IAddToWebRequest requesttype, Func <ICloudFilesRequest> requeststrategy, string authtoken) { var cfrequest = requeststrategy.Invoke(); //only way I've figured out how to make auth header logic conditional, this is a smell and in need of a better pattern if (!String.IsNullOrEmpty(authtoken)) { AddAuthHeaderToRequest(cfrequest, authtoken); } requesttype.Apply(cfrequest); var response = _responsefactory.Create(cfrequest); return(response); }
public static void AssertMethod(IAddToWebRequest addtowebrequest, string method) { var _mockrequest = new Mock<ICloudFilesRequest>(); addtowebrequest.Apply(_mockrequest.Object); _mockrequest.VerifySet(x => x.Method = method); }