예제 #1
0
        public void TestMethod1()
        {
            UnitTest1 unitTest1 = new UnitTest1();
            int       i         = 0;
            TestModel Entity    = new TestModel()
            {
                Name     = "殷振召",
                Sex      = "男",
                Addresss = "奥特之星72星云",
                Tel      = "1388888888",
                Remark   = "不同寻常的奥特之星"
            };

            //  Assert.AreEqual(base.TestInsert(Entity), true);

            //  var query = base.TestGetSinge<TestModel>("1");

            base.CheckIsTestorStandard(typeof(TestModel));
        }
예제 #2
0
        public void LoginAsync()
        {
            Moq.Mock <UserRepository> mock = new Moq.Mock <UserRepository>((object)null);
            mock.Setup(m => m.Login("Teste1", "123456")).Returns(Task.FromResult(UnitTest1.RetornarUsuarioTest()));

            var _loginController = new LoginController(mock.Object);

            Login login = new Login();

            login.NameLogin = "******";
            login.Password  = "******";

            Microsoft.AspNetCore.Mvc.ActionResult <dynamic> loged = Task.Run(async() =>
            {
                return(await _loginController.Login(login));
            }).GetAwaiter().GetResult();

            var ok = (Microsoft.AspNetCore.Mvc.OkObjectResult)loged.Result;

            Assert.AreNotEqual(null, ok.Value);
        }