public void AddContactRequest_ShouldReturnBool_Sad() { Users user = new Users(); user.UserId = 1; ProductListingData productListingData = new ProductListingData(); productListingData.ProductListingId = 1; Seed(_orchard1Context); var result = userData.AddContactRequest(productListingData, user); Assert.IsFalse(result.Result); }
public async Task <bool> AddContactRequest(ProductListingData productListing, Users user) { try { return(await _UserData.AddContactRequest(productListing, user)); } catch (DataNotSavedException) { return(await Task.FromResult(false)); } }
public async Task AddContactRequest_ShouldThrowException_WhenException_Bad() { Users user = new Users(); user.UserId = 3; ProductListingData productListingData = new ProductListingData(); productListingData.ProductListingId = 1; //Arrange _mockedOrchardContext.Setup(o => o.ProductListingData).Throws(new GeneralException()); //Act //Assert await Assert.ThrowsExceptionAsync <DataNotSavedException>(async() => await _mockedUserData.AddContactRequest(productListingData, user)); }