Example #1
0
        public async void DeleteFileUploads_Returns_OK()
        {
            var query = new FileUploadsController(context, null);

            var result = await query.DeleteFileUploads(2);  // async

            Assert.IsType <ActionResult <FileUploads> >(result);
        }
Example #2
0
        public async void GetFileUploads_In_Case_Returns_OK()
        {
            var query = new FileUploadsController(context, null);

            var result = await query.GetFileUploadsInCase(1);  // async

            Assert.IsType <ActionResult <IEnumerable <FileUploads> > >(result);
        }
Example #3
0
        public async void GetFileUploads_In_Case()
        {
            var query = new FileUploadsController(context, null);

            var result = await query.GetFileUploadsInCase(1);  // async

            Assert.Equal(4, result.Value.ToList().Count);
            Assert.Equal(4, result.Value.Count());
        }
Example #4
0
        public async void GetFileUploads_In_Case_Check_First_And_Last()
        {
            var query = new FileUploadsController(context, null);

            var result = await query.GetFileUploadsInCase(1);  // async

            result = result.Value.OrderByDescending(x => x.Id).ToList();

            Assert.Equal(6, result.Value.First().Id);
            Assert.Equal(1, result.Value.Last().Id);
        }
Example #5
0
        public async void DeleteFileUploads_Delete_Id_2()
        {
            var query = new FileUploadsController(context, null);

            var result = await query.DeleteFileUploads(2);  // async

            Assert.Equal(2, result.Value.Id);
            Assert.Equal(1, result.Value.CaseId);
            Assert.Equal("b12345", result.Value.URL);
            Assert.Equal("Desc2", result.Value.Description);
            Assert.Equal("iii12345", result.Value.PublicId);
        }
Example #6
0
        public async void PostFileUploads_Returns_OK()
        {
            var query = new FileUploadsController(context, null);

            var newUpload = new FileUploadsCreate {
                CaseId = 3, URL = "g12345", Description = "Desc7", PublicId = "nnn12345"
            };                                                    // Id = 7

            var result = await query.PostFileUploads(newUpload);  // async

            Assert.IsType <ActionResult <FileUploadsCreate> >(result);
            Assert.IsType <CreatedAtActionResult>(result);
        }
Example #7
0
        public async void PostFileUploads_Add_And_Save_Upload_To_Cloud()
        {
            var query = new FileUploadsController(context, null);

            var newUpload = new FileUploadsCreate {
                CaseId = 3, URL = "g12345", Description = "Desc7", PublicId = "nnn12345",
                File   = {  }
            };                                                   // Id = 7

            var result = await query.PostFileUploads(newUpload); // async

            var added = await query.GetFileUploadsDetails(7);    // async

            var resultGoodRequest = Assert.IsType <CreatedAtActionResult>(result);
            var addedGoodRequest  = Assert.IsType <FileUploadsCreate>(added.Value);

            Assert.Equal(newUpload.CaseId, added.Value.CaseId);
            Assert.Equal(newUpload.URL, added.Value.URL);
            Assert.Equal(newUpload.Description, added.Value.Description);
            Assert.Equal(newUpload.PublicId, added.Value.PublicId);
            Assert.Equal(7, added.Value.Id);
            Assert.Equal(newUpload, resultGoodRequest.Value);
            Assert.Equal(newUpload, addedGoodRequest);
        }