public void CheckUser() { unitOfWork.Data = Utils.CreateAdminAndUser(); var result = controller.CheckUser(new ChangePassword { code = "3" }); Assert.IsInstanceOfType(result, typeof(HttpResponseMessage)); var message = result as HttpResponseMessage; Assert.AreEqual(HttpStatusCode.BadRequest, message?.StatusCode); result = controller.CheckUser(new ChangePassword { code = "2" }); Assert.IsNotInstanceOfType(result, typeof(HttpResponseMessage)); Assert.IsInstanceOfType(result, typeof(ChangePassword)); Assert.IsFalse(string.IsNullOrEmpty((result as ChangePassword)?.ruleText)); }