Exemple #1
0
        public async Task Run_StateUnderTest_ExpectedBehavior()
        {
            // Arrange
            _docRepository.Setup(x => x.GetByExpression(It.IsAny <Expression <Func <Document, bool> > >()))
            .Returns(
                new List <Document>
            {
                new Document
                {
                    Id        = 1,
                    Name      = "SomeName.docx",
                    Reference = DOC_NUMB
                }
            }.AsQueryable());
            var documentsFn = new DocumentsFn(_docRepository.Object);
            var request     = RequestHelper.MockRequest("{\"example\":\"\"}");

            // Act
            var result = await documentsFn.Run(
                request,
                DOC_NUMB,
                _logger);

            // Assert
            Assert.IsType <OkObjectResult>(result);
        }
Exemple #2
0
        public async Task Run_StateUnderTest_FailBehavior()
        {
            // Arrange
            _docRepository.SetReturnsDefault(new List <Document>().AsQueryable());
            var documentsFn = new DocumentsFn(_docRepository.Object);
            var request     = RequestHelper.MockRequest("{\"example\":\"\"}");

            // Act
            var result = await documentsFn.Run(
                request,
                null,
                _logger);

            // Assert
            Assert.IsType <NotFoundObjectResult>(result);
        }