Exemple #1
0
        public async Task GetUsersSampleSetsAsync_ShouldReturnOKObject()
        {
            UsersSampleSets usersSampleSets = new UsersSampleSets();

            _projectBLMock.Setup(i => i.GetUsersSampleSetsAsync());
            UsersSampleSetsController usersSampleSetsController = new UsersSampleSetsController(_projectBLMock.Object);

            var result = await usersSampleSetsController.GetUsersSampleSetsAsync();

            Assert.IsType <OkObjectResult>(result);
        }
Exemple #2
0
        public async Task AddUsersSampleSetsAsync_ShouldReturnCreatedAtAction_WhenUsersSampleSetsIsValid()
        {
            UsersSampleSets usersSampleSets = new UsersSampleSets();

            _projectBLMock.Setup(i => i.AddUsersSampleSetsAsync(usersSampleSets)).ReturnsAsync(usersSampleSets);
            UsersSampleSetsController usersSampleSetsController = new UsersSampleSetsController(_projectBLMock.Object);

            var result = await usersSampleSetsController.AddUsersSampleSetsAsync(usersSampleSets);

            Assert.IsType <CreatedAtActionResult>(result);
        }
Exemple #3
0
        public async Task GetUsersSampleSetsByUserIDAsync_ShouldReturnNotFound_WhenUserSampleSetsIsInvalid()
        {
            List <UsersSampleSets> usersSampleSets = null;
            int id = -21;

            _projectBLMock.Setup(i => i.GetUsersSampleSetsByUserIDAsync(id)).ReturnsAsync(usersSampleSets);
            UsersSampleSetsController usersSampleSetsController = new UsersSampleSetsController(_projectBLMock.Object);

            var result = await usersSampleSetsController.GetUsersSampleSetsByUserIDAsync(id);

            Assert.IsType <NotFoundResult>(result);
        }
Exemple #4
0
        public async Task GetUsersSampleSetsByUserIDAsync_ShouldReturnOkObject_WhenIDIsValid()
        {
            List <UsersSampleSets> usersSampleSets = new List <UsersSampleSets>();
            int id = 1;

            _projectBLMock.Setup(i => i.GetUsersSampleSetsByUserIDAsync(id)).ReturnsAsync(usersSampleSets);
            UsersSampleSetsController usersSampleSetsController = new UsersSampleSetsController(_projectBLMock.Object);

            var result = await usersSampleSetsController.GetUsersSampleSetsByUserIDAsync(id);

            Assert.IsType <OkObjectResult>(result);
        }
Exemple #5
0
        public async Task DeleteUsersSampleSetsAsync_ShouldReturnNoContent_WhenIDIsValid()
        {
            int             id = 1;
            UsersSampleSets usersSampleSets = new UsersSampleSets();

            _projectBLMock.Setup(i => i.DeleteUsersSampleSetsAsync(usersSampleSets)).ReturnsAsync(usersSampleSets);
            UsersSampleSetsController usersSampleSetsController = new UsersSampleSetsController(_projectBLMock.Object);

            var result = await usersSampleSetsController.DeleteUsersSampleSetsAsync(id);

            Assert.IsType <NoContentResult>(result);
        }
Exemple #6
0
        public async Task AddUsersSampleSetsAsync_ShouldReturnStatusCode400_WhenUsersSampleSetsIsInvalid()
        {
            UsersSampleSets usersSampleSets = null;

            _projectBLMock.Setup(i => i.AddUsersSampleSetsAsync(usersSampleSets)).Throws(new Exception());
            UsersSampleSetsController usersSampleSetsController = new UsersSampleSetsController(_projectBLMock.Object);

            var result = await usersSampleSetsController.AddUsersSampleSetsAsync(usersSampleSets);

            Assert.IsType <StatusCodeResult>(result);
            Assert.Equal(400, ((StatusCodeResult)result).StatusCode);
        }
Exemple #7
0
        public async Task DeleteUsersSampleSetsAsync_ShouldReturnStatusCode500_WhenIDIsInvalid()
        {
            int             id = -1;
            UsersSampleSets usersSampleSets = null;

            _projectBLMock.Setup(i => i.DeleteUsersSampleSetsAsync(usersSampleSets)).Throws(new Exception());
            UsersSampleSetsController usersSampleSetsController = new UsersSampleSetsController(_projectBLMock.Object);

            var result = await usersSampleSetsController.DeleteUsersSampleSetsAsync(id);

            Assert.IsType <StatusCodeResult>(result);
            Assert.Equal(500, ((StatusCodeResult)result).StatusCode);
        }