Esempio n. 1
0
        public IHttpActionResult create([FromBody] DBUser user)
        {
            UserService us = new UserService(User, ctx);
            us.User = user;

               return Json(us.Create());
        }
Esempio n. 2
0
        IActionResult IUserController.create([FromBody] DBUser user)
        {


            UserService us = new UserService( ctx);
            us.User = user;

           
           return Json(us.Create());
            


        }
Esempio n. 3
0
        public void Can_Create_User()
        {
            //var user = WindowsPrincipal.Current;

            var HttpContextMock = new Mock<HttpContextBase>();
            var lWindowsIdentity = new WindowsIdentity("lapierce");
            HttpContextMock.Setup(x => x.User).Returns(new WindowsPrincipal(lWindowsIdentity));

            var user = new WindowsPrincipal(lWindowsIdentity);

            var service = new UserService(user, mockContext.Object);

            service.Create();

            mockContext.Verify(m => m.SaveChanges(), Times.Once());
        }