public void VerifyCustomersDetailsReturnAction() { VehicleStatus Temp_Enumvalue = VehicleEnumExtension.Of <VehicleStatus>(); var customerRepos = new Mock <IVehiclesRepository>(); customerRepos.Setup(v => v.GetCustomersById(It.IsAny <string>())).Returns(new Customers { VIN = "YS2R4X20005399401", RegNr = "ABC123", CustomersName = "Kalles Grustransporter AB", CustomerAddresses = "Cementvägen 8, 111 11 Södertälje", ConnectionStatus = Temp_Enumvalue, VehicleconnectedTime = DateTime.Now, }); var controller = new VehiclesController(customerRepos.Object); var result = Assert.IsType <Microsoft.AspNetCore.Mvc.ViewResult>(controller.Detail("YS2R4X20005399401")); var model = Assert.IsType <Customers>(result.Model); Assert.Equal("ABC123", model.RegNr); }