public async Task InsertVendor_ReturnsVendor() { // arrange var vendor = new Vendor { id = 123, userName = "******", name = "name1", website = "website_1" }; var service = new VendorServices { vendorId = 123, flatFee = true, price = 20, serviceDescription = "desc", serviceName = "svcName", serviceType = "Venue" }; vendor.services = new List <VendorServices> { service }; _addressQueryMock.Setup(x => x.Insert(It.IsAny <Address>())) .Returns(Task.Factory.StartNew(() => 999)); _vendorsQueryMock.Setup(x => x.Insert(vendor)) .Returns(Task.Factory.StartNew(() => vendor)); // act var task = await _sut.Insert(vendor); // assert Assert.IsType <OkObjectResult>(task); var result = task as OkObjectResult; var usersResult = result.Value as Vendor; Assert.Equal(vendor, usersResult); }