示例#1
0
        public async Task Insert_Test(CategoryInfo categoryRequest, bool isExist, ResultModel <string> expectedModel)
        {
            _categoryRepository
            .Setup(x => x.AnyAsync(It.IsAny <Expression <Func <CategoryInfo, bool> > >())).ReturnsAsync(isExist);
            _categoryRepository.Setup(x => x.InsertAsync(It.IsAny <CategoryInfo>())).ReturnsAsync(1);
            var actualModel = await _categoryBusiness.InsertAsync(categoryRequest);

            var actualStr   = JsonConvert.SerializeObject(actualModel);
            var expectedStr = JsonConvert.SerializeObject(expectedModel);

            Assert.Equal(expectedStr, actualStr);
        }