public void TestBuildentityActionCanNotBeNull() { MockReadEntitiesByPathParameters mutableParameters = new MockReadEntitiesByPathParameters(); mutableParameters.ItemSource = LegacyConstants.DefaultSource(); mutableParameters.SessionSettings = this.sessionConfig; mutableParameters.EntitySource = new EntitySource("Namespace", null, "Controller", null); IBaseEntityRequest request = mutableParameters; TestDelegate action = () => this.getEntityBuilder.GetUrlForRequest(request); Assert.Throws <ArgumentNullException>(action); }
public void TestBuildWithValidPath() { MockReadEntitiesByPathParameters mutableParameters = new MockReadEntitiesByPathParameters(); mutableParameters.ItemSource = LegacyConstants.DefaultSource(); mutableParameters.SessionSettings = this.sessionConfig; mutableParameters.EntitySource = new EntitySource("namespace", "controller", "id", "action"); IBaseEntityRequest request = mutableParameters; string result = this.getEntityBuilder.GetUrlForRequest(request); string expected = "https://mobiledev1ua1.dk.sitecore.net/sitecore/api/ssc/namespace/controller/id/action"; Assert.AreEqual(expected, result); }
public void TestBuildCustomParametersIsCaseSensitive() { MockReadEntitiesByPathParameters mutableParameters = new MockReadEntitiesByPathParameters(); mutableParameters.ItemSource = LegacyConstants.DefaultSource(); mutableParameters.SessionSettings = this.sessionConfig; mutableParameters.EntitySource = new EntitySource("namespace", "controller", "id", "action"); mutableParameters.ParametersRawValuesByName = new Dictionary <string, string>() { { "fIeLd1", "VaLuE1" }, { "FiElD2", "vAlUe2" } }; IBaseEntityRequest request = mutableParameters; string result = this.getEntityBuilder.GetUrlForRequest(request); string expected = "https://mobiledev1ua1.dk.sitecore.net/sitecore/api/ssc/namespace/controller/id/action?fIeLd1=VaLuE1&FiElD2=vAlUe2"; Assert.AreEqual(expected, result); }