public async void CreateNewBill_OkResult() { // Arrange int residentId = 1, apartmentId = 1; Mock <GenericRepository <Bill> > mockBillRepository = new Mock <GenericRepository <Bill> >(); Mock <UserRepository> mockUserRepository = new Mock <UserRepository>(); Mock <ApartmentRepository> mockApartmentRepository = new Mock <ApartmentRepository>(); Mock <GenericRepository <Notification> > mockNotificationRepository = new Mock <GenericRepository <Notification> >(); Mock <IUnitOfWork> mockIUnitOfWork = new Mock <IUnitOfWork>(); mockIUnitOfWork .Setup(u => u.GetRepository <Bill, GenericRepository <Bill> >()) .Returns(mockBillRepository.Object); mockIUnitOfWork .Setup(u => u.GetRepository <User, UserRepository>()) .Returns(mockUserRepository.Object); mockIUnitOfWork .Setup(u => u.GetRepository <Apartment, ApartmentRepository>()) .Returns(mockApartmentRepository.Object); mockIUnitOfWork .Setup(u => u.GetRepository <Notification, GenericRepository <Notification> >()) .Returns(mockNotificationRepository.Object); BillsController controller = new BillsController(mockIUnitOfWork.Object); // Act IActionResult result = await controller.CreateNewBill(residentId, apartmentId, new DateTime()); // Assert Assert.NotNull(result); Assert.IsType <OkResult>(result); }