public void ShouldDetermineBaseUrl() { //Act var desc = ServiceDescription.Create(typeof(IContract)); //Assert Assert.Equal("http://foo", desc.Url); }
public void ShouldCalculateRightUrl(Type contractType, string methodName, string baseAddress, string expectedUrl) { //Arrange var srvDesc = ServiceDescription.Create(contractType); var method = contractType.GetMethod(methodName); var mDesc = srvDesc.Methods .Where(kv => kv.Key == method.MetadataToken) .Select(kv => kv.Value) .First(); var reqMsgBuilder = new HttpRequestMessageBuilder(baseAddress, mDesc); //Act var reqMsg = reqMsgBuilder.Build(); //Assert Assert.Equal(expectedUrl, reqMsg.RequestUri.OriginalString); }
public void ShouldFailIfApiAttributeIsAbsent() { Assert.Throws <ApiContractException>(() => ServiceDescription.Create(typeof(IContractWithoutApiAttr))); }