public async Task TestRegisterTime_Bellow30() { var rtr = new RegisterTimeRequest { ProjectID = 1, Minutes = 23, Notes = "dfgdfhcfhncfhjcgfhj" }; var content = new StringContent(JsonSerializer.Serialize(rtr), Encoding.UTF8, "application/json"); var expResp = await GetHttpResponseAsText($"/api/Projects/RegisterTime", Methods.Post, content); Assert.IsTrue(expResp.Contains("The field Minutes must be between 30 and 2147483647.")); }
public async Task TestRegisterTime_ProjectDoesNotExisting() { var rtr = new RegisterTimeRequest { ProjectID = 13, Minutes = 34, Notes = "dfgdfhcfhncfhjcgfhj" }; var content = new StringContent(JsonSerializer.Serialize(rtr), Encoding.UTF8, "application/json"); var expResp = await GetHttpResponseAsText($"/api/Projects/RegisterTime", Methods.Post, content); Assert.AreEqual(expResp, ac.RegisterTime(rtr.ProjectID, rtr.Minutes, rtr.Notes)); }
public string RegisterTime(RegisterTimeRequest rtr) => _context.RegisterTime(rtr.ProjectID, rtr.Minutes, rtr.Notes);