コード例 #1
0
        public void Get_WhenCalled_ReturnsOkResult()
        {
            // Act
            var okResult = _controller.Get();

            // Assert
            Assert.IsType <OkObjectResult>(okResult.Result);
        }
コード例 #2
0
        public void Test_Does_User_Exist()
        {
            var mo = new Mock <IUserCrud>();

            mo.Setup(mo => mo.Get())
            .Returns(RetrieveUser());

            //Create the controller in use
            var controller = new userController(mo.Object);

            var retrieved = controller.Get("KimJongUn");

            Assert.Collection(retrieved, item => Assert.Contains("KimJongUn", item.UserName));
        }