public async Task cannot_put_existing_agent_profile_when_etag_is_invalid() { // Arrange var state = new AgentProfileDocument <string>() { Content = "foo", ETag = ETAG }; var request = PutAgentProfileRequest.Create(state); request.Agent = new Agent() { Name = AGENT_NAME, MBox = new Uri(AGENT_MBOX) }; request.ProfileId = PROFILE_ID; this._mockHttp .When(HttpMethod.Put, this.GetApiUrl("agents/profile")) .WithQueryString("agent", AGENT_QS) .WithQueryString("profileId", PROFILE_ID) .WithHeaders("If-Match", ETAG) .Respond(HttpStatusCode.PreconditionFailed); // Act bool result = await this._client.AgentProfiles.Put(request); // Assert result.Should().BeFalse(); }
public async Task can_put_new_agent_profile() { // Arrange var state = new AgentProfileDocument <string>() { Content = "foo" }; var request = PutAgentProfileRequest.Create(state); request.Agent = new Agent() { Name = AGENT_NAME, MBox = new Uri(AGENT_MBOX) }; request.ProfileId = PROFILE_ID; this._mockHttp .When(HttpMethod.Put, this.GetApiUrl("agents/profile")) .WithQueryString("agent", AGENT_QS) .WithQueryString("profileId", PROFILE_ID) .WithHeaders("If-None-Match", "*") .Respond(HttpStatusCode.NoContent); // Act bool result = await this._client.AgentProfiles.Put(request); // Assert result.Should().BeTrue(); }