public void DeleteRole() { unitOfWork.Data = Utils.CreateAdminAndUser(); unitOfWork.Data.Roles = new List <Role> { new Role { id = 1, name = "admin" }, new Role { id = 4, name = "restricted" } }; controller.Request.Headers.Authorization = new AuthenticationHeaderValue("jwt", "2"); var result = controller.DeleteRole(1); Assert.IsInstanceOfType(result, typeof(UnauthorizedResult)); controller.Request.Headers.Authorization = new AuthenticationHeaderValue("jwt", "1"); result = controller.DeleteRole(1); Utils.AssertRequestMessageAndStatus(result, HttpStatusCode.BadRequest); result = controller.DeleteRole(4); Assert.AreEqual(true, result); }