public async void GetDocumentsFromSearchFuzzySearchNoDocumentsFound()
        {
            using (var context = DbTestContext.GenerateContextWithData())
                using (var controller = new DocumentsInternalController(context, _mapper))
                {
                    var result = await controller.GetDocumentsFromSearch("mihailo", 100, 1, false);

                    Assert.IsType <NotFoundResult>(result);
                }
        }
        public async void GetDocumentsFromSearch50_3NoDocumentsFound()
        {
            using (var context = DbTestContext.GenerateContextWithData())
                using (var controller = new DocumentsInternalController(context, _mapper))
                {
                    var result = await controller.GetDocumentsFromSearch("test", 50, 3);

                    Assert.IsType <NotFoundResult>(result);
                }
        }
        public async void GetDocumentsFromSearchBadModel()
        {
            using (var context = DbTestContext.GenerateContextWithData())
                using (var controller = new DocumentsInternalController(context, _mapper))
                {
                    controller.ModelState.AddModelError("an error", "some error");
                    var result = await controller.GetDocumentsFromSearch("test");

                    Assert.IsType <BadRequestObjectResult>(result);
                }
        }
        public async void GetDocumentsFromSearchFuzzySearchReturnsMatches()
        {
            using (var context = DbTestContext.GenerateContextWithData())
                using (var controller = new DocumentsInternalController(context, _mapper))
                {
                    var result = await controller.GetDocumentsFromSearch("Document Test", 150, 1, false);

                    Assert.NotNull(result);
                    var okObjectResult = Assert.IsType <OkObjectResult>(result);
                    var resultValue    = okObjectResult.Value;
                    Assert.IsAssignableFrom <IEnumerable <DocumentDtoInternal> >(resultValue);
                    Assert.NotEmpty((IEnumerable <DocumentDtoInternal>)resultValue);

                    IEnumerable <DocumentDtoInternal> resultValueList = (IEnumerable <DocumentDtoInternal>)resultValue;
                    Assert.True(resultValueList.Count().Equals(50));
                }
        }
        public async void GetDocumentsFromSearch50ReturnsListOfDocuments()
        {
            using (var context = DbTestContext.GenerateContextWithData())
                using (var controller = new DocumentsInternalController(context, _mapper))
                {
                    var result = await controller.GetDocumentsFromSearch("test", 50);

                    DocumentDtoInternal d4 = GetTestDocumentDtoFromContext(4);

                    Assert.NotNull(result);
                    var okObjectResult = Assert.IsType <OkObjectResult>(result);
                    var resultValue    = okObjectResult.Value;
                    Assert.IsAssignableFrom <IEnumerable <DocumentDtoInternal> >(resultValue);
                    Assert.NotEmpty((IEnumerable <DocumentDtoInternal>)resultValue);

                    IEnumerable <DocumentDtoInternal> resultValueList = (IEnumerable <DocumentDtoInternal>)resultValue;
                    Assert.True(resultValueList.Count().Equals(50));

                    DocumentDtoInternal d = (DocumentDtoInternal)resultValueList.Single(r => r.Id == 4);
                    Assert.True(d.Equals(d4));
                    Assert.True(d.Equals(d4, true));
                }
        }