예제 #1
0
        public static void AssertMethod(IAddToWebRequest addtowebrequest, string method)
        {
            var _mockrequest = new Mock <ICloudFilesRequest>();

            addtowebrequest.Apply(_mockrequest.Object);
            _mockrequest.VerifySet(x => x.Method = method);
        }
예제 #2
0
 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;
 }
예제 #3
0
 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);
 }
예제 #4
0
        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);
        }
예제 #5
0
        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;
        }
예제 #7
0
        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);
        }
예제 #8
0
 public static void AssertMethod(IAddToWebRequest addtowebrequest, string method)
 {
     var _mockrequest = new Mock<ICloudFilesRequest>();
     addtowebrequest.Apply(_mockrequest.Object);
     _mockrequest.VerifySet(x => x.Method = method);
 }