Esempio n. 1
0
        public async Task Post_IsDemandCreated_ReturnsTrue()
        {
            // Act
            _mockDemandRepository.Setup(repo => repo.Post(new Demand {
                PrimarySkills = "NET", SecondarySkills = "java", Location = "Pune", Start_By_Date = DateTime.Now, Experience = 10
            }))
            .ReturnsAsync(true);
            var result = await _controller.Post(new Demand { PrimarySkills = "NET", SecondarySkills = "java", Location = "Pune", Start_By_Date = DateTime.Now, Experience = 10 });

            // Assert
            Assert.Pass();
            var okObjectResult = result as OkObjectResult;

            Assert.IsNotNull(okObjectResult);
            Assert.Equals(true, result);
        }
        public async Task Post_IsDemandNull_ReturnsFalse()
        {
            // Act
            _mockDemandRepository.Setup(repo => repo.Post(null))
            .ReturnsAsync(false);
            var result = await _controller.Post(null);


            // Assert
            Assert.Pass();
            var okObjectResult = result as OkObjectResult;

            Assert.IsNotNull(okObjectResult);
            Assert.Equals(false, result);
        }