Пример #1
0
        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);
        }
Пример #2
0
 public async Task <bool> AddContactRequest(ProductListingData productListing, Users user)
 {
     try
     {
         return(await _UserData.AddContactRequest(productListing, user));
     }
     catch (DataNotSavedException)
     {
         return(await Task.FromResult(false));
     }
 }
Пример #3
0
        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));
        }