public void GetSessionManagementMethodConfigParameters( [Frozen] Mock <IHttpClient> httpClientMock, [Greedy] SessionManagementComponent sut, string methodName, IEnumerable <ConfigurationParameter> configParameters) { // ARRANGE var json = new JObject( new JProperty("methodConfigParams", JArray.FromObject(configParameters))); httpClientMock.SetupApiCall(sut, CallType.View, "getSessionManagementMethodConfigParams", new Parameters { { "methodName", methodName } }) .Returns(json.ToString()) .Verifiable(); // ACT var result = sut.GetSessionManagementMethodConfigParameters(methodName); // ASSERT result.ShouldBeEquivalentTo(configParameters); httpClientMock.Verify(); }
public void SetSessionManagementMethod( [Frozen] Mock <IHttpClient> httpClientMock, [Greedy] SessionManagementComponent sut, int contextId, SessionManagementMethod sessionManagementMethod) { // ARRANGE var parameters = new Parameters { { "contextId", contextId }, { "methodName", sessionManagementMethod.MethodName } }; foreach (var parameter in sessionManagementMethod.Parameters) { parameters.Add(parameter.Key, parameter.Value); } httpClientMock.SetupApiCall(sut, CallType.Action, "setSessionManagementMethod", parameters) .ReturnsOkResult() .Verifiable(); // ACT sut.SetSessionManagementMethod(contextId, sessionManagementMethod); // ASSERT httpClientMock.Verify(); }
public ZapClient(string host, int port, Protocols protocol = Protocols.http) { Protocol = protocol; Host = host; Port = port; Acsrf = new AcsrfComponent(this); AjaxSpider = new AjaxSpiderComponent(this); Ascan = new AscanComponent(this); Authentication = new AuthenticationComponent(this); Authorization = new AuthorizationComponent(this); Autoupdate = new AutoupdateComponent(this); Break = new BreakComponent(this); Context = new ContextComponent(this); Core = new CoreComponent(this); ForcedUser = new ForcedUserComponent(this); HttpSessions = new HttpSessionsComponent(this); Params = new ParamsComponent(this); Pscan = new PscanComponent(this); Reveal = new RevealComponent(this); Script = new ScriptComponent(this); Search = new SearchComponent(this); Selenium = new SeleniumComponent(this); SessionManagement = new SessionManagementComponent(this); Spider = new SpiderComponent(this); Users = new UsersComponent(this); }
public void ComponentName( [Greedy] SessionManagementComponent sut) { // ACT var result = sut.ComponentName; // ASSERT result.Should().Be("sessionManagement"); }
public void GetSupportedSessionManagementMethods( [Frozen] Mock <IHttpClient> httpClientMock, [Greedy] SessionManagementComponent sut, IEnumerable <string> methodNames) { // ARRANGE var json = new JObject( new JProperty("supportedMethods", JArray.FromObject(methodNames))); httpClientMock.SetupApiCall(sut, CallType.View, "getSupportedSessionManagementMethods") .Returns(json.ToString()) .Verifiable(); // ACT var result = sut.GetSupportedSessionManagementMethods(); // ASSERT result.ShouldBeEquivalentTo(methodNames); httpClientMock.Verify(); }
public void GetSessionManagementMethod( [Frozen] Mock <IHttpClient> httpClientMock, [Greedy] SessionManagementComponent sut, int contextId, SessionManagementMethod sessionManagementMethod) { // ARRANGE var json = JObject.FromObject(sessionManagementMethod); httpClientMock.SetupApiCall(sut, CallType.View, "getSessionManagementMethod", new Parameters { { "contextId", contextId } }) .Returns(json.ToString()) .Verifiable(); // ACT var result = sut.GetSessionManagementMethod(contextId); // ASSERT result.ShouldBeEquivalentTo(sessionManagementMethod); httpClientMock.Verify(); }