public void PutRequest_ReturnsCorrectObject() { var userToUpdate = new User() { Email = "*****@*****.**", GivenName = "ThisIsADopeBoy", // This line was changed LastName = "SwaggerDagger", Password = "******", Username = "******" }; _uut = new HttpRequestBuilder(_fakeClient, HttpMethod.Put, "http://localhost:50244"); _uut.AddUriPath("/api/User") .AddAuthentication(userToUpdate.Username, userToUpdate.Password) .AddContent(userToUpdate); var response = _uut.SendAsync().Result; Assert.That(response.IsSuccessStatusCode); var user = response.ReadBodyAsType <User>(); Assert.That(user.GivenName == "ThisIsADopeBoy"); }
public void GetRequest_ReturnsCorrectInfo() { _uut = new HttpRequestBuilder(_fakeClient, HttpMethod.Get, "http://localhost:50244"); _uut.AddUriPath("/api/User/Login") .AddAuthentication("jonasna1993", "tablespoon1335"); var response = _uut.SendAsync().Result; Assert.That(response.IsSuccessStatusCode); }
public void GetRequest_ReturnsCorrectObject() { _uut = new HttpRequestBuilder(_fakeClient, HttpMethod.Get, "http://*****:*****@gmail.com"); }
public void AddQuery_ReturnsCorrectObject_VersionThree() { string username = "******"; string password = "******"; _uut = new HttpRequestBuilder(_fakeClient, HttpMethod.Post, "http://localhost:50244"); _uut.AddUriPath("/api/Lobby/Leave").AddAuthentication(username, password).AddUriQuery("lobbyId", "MyLobby"); var response = _uut.SendAsync().Result; Assert.That(response.IsSuccessStatusCode); var lobby = response.ReadBodyAsType <Lobby>(); Assert.That(!lobby.Usernames.Contains(username)); }
public void AddQuery_ReturnsCorrectObject() { string username = "******"; string password = "******"; _uut = new HttpRequestBuilder(_fakeClient, HttpMethod.Post, "http://localhost:50244"); _uut.AddUriPath("/api/Lobby/Create").AddAuthentication(username, password).AddUriQuery("lobbyId", "MyLobby"); var response = _uut.SendAsync().Result; Assert.That(response.IsSuccessStatusCode); var lobby = response.ReadBodyAsType <Lobby>(); Assert.That(lobby.Id == "MyLobby"); }