Example #1
0
        public async void Task_GetOccupation_Return_OkResult()
        {
            //Arrange
            var controller = new OccupationController(repository);

            //Act
            var data = await controller.GetOccupation();

            //Assert
            Assert.IsType <OkObjectResult>(data);
        }
Example #2
0
        public void Task_GetOccupation_Return_BadRequestResult()
        {
            //Arrange
            var controller = new OccupationController(repository);

            //Act
            var data = controller.GetOccupation();

            data = null;

            if (data != null)
            {
                //Assert
                Assert.IsType <BadRequestResult>(data);
            }
        }
Example #3
0
        public async void Task_GetOccupation_MatchResult()
        {
            //Arrange
            var controller = new OccupationController(repository);

            //Act
            var data = await controller.GetOccupation();

            //Assert
            Assert.IsType <OkObjectResult>(data);

            var okResult = data.Should().BeOfType <OkObjectResult>().Subject;
            var post     = okResult.Value.Should().BeAssignableTo <List <PostViewModel> >().Subject;

            Assert.Equal("Cleaner", post[0].Occupation);
            Assert.Equal("Light Manual", post[0].Rating);

            Assert.Equal("Doctor", post[1].Occupation);
            Assert.Equal("Professional", post[1].Rating);
        }