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 GetForcedUser( [Frozen] Mock <IHttpClient> httpClientMock, [Greedy] ForcedUserComponent sut, int contextId, int userId) { // ARRANGE var json = new JObject( new JProperty("forcedUserId", userId)); httpClientMock.SetupApiCall(sut, CallType.View, "getForcedUser", new Parameters { { "contextId", contextId } }) .Returns(json.ToString()) .Verifiable(); // ACT var result = sut.GetForcedUser(contextId); // ASSERT result.Should().Be(userId); httpClientMock.Verify(); }
public void ComponentName( [Greedy] ForcedUserComponent sut) { // ACT var result = sut.ComponentName; // ASSERT result.Should().Be("forcedUser"); }
public void IsForcedUserModeEnabled( [Frozen] Mock <IHttpClient> httpClientMock, [Greedy] ForcedUserComponent sut, bool enabled) { // ARRANGE var json = new JObject( new JProperty("forcedModeEnabled", enabled)); httpClientMock.SetupApiCall(sut, CallType.View, "isForcedUserModeEnabled") .Returns(json.ToString()) .Verifiable(); // ACT var result = sut.IsForcedUserModeEnabled(); // ASSERT result.Should().Be(enabled); httpClientMock.Verify(); }
public void SetForcedUserModeEnabled( [Frozen] Mock <IHttpClient> httpClientMock, [Greedy] ForcedUserComponent sut, bool enabled) { // ARRANGE httpClientMock.SetupApiCall(sut, CallType.Action, "setForcedUserModeEnabled", new Parameters { { "boolean", enabled } }) .ReturnsOkResult() .Verifiable(); // ACT sut.SetForcedUserModeEnabled(enabled); // ASSERT httpClientMock.Verify(); }
public void SetForcedUser( [Frozen] Mock <IHttpClient> httpClientMock, [Greedy] ForcedUserComponent sut, int contextId, int userId) { // ARRANGE httpClientMock.SetupApiCall(sut, CallType.Action, "setForcedUser", new Parameters { { "contextId", contextId }, { "userId", userId } }) .ReturnsOkResult() .Verifiable(); // ACT sut.SetForcedUser(contextId, userId); // ASSERT httpClientMock.Verify(); }