Ejemplo n.º 1
0
        private void AddTwoUsers()
        {
            var user1 = TestInitialiser.CreateUser();

            user1.UserName = firstUsername;
            user1.Email    = "*****@*****.**";
            var user2 = TestInitialiser.CreateUser();

            user2.UserName = secondUsername;
            user2.Email    = "*****@*****.**";
            crudOnUsers.CreateOrUpdateUser(user1).Wait();
            crudOnUsers.CreateOrUpdateUser(user2).Wait();
        }
Ejemplo n.º 2
0
        public void Initialize()
        {
            TestInitialiser.Initialise();
            crudOnFavorites = TestInitialiser.ninjectKernel.kernel.Get <ICrudOnFavorites>();
            crudOnProducts  = TestInitialiser.ninjectKernel.kernel.Get <ICrudOnProducts>();
            crudOnUsers     = TestInitialiser.ninjectKernel.kernel.Get <ICrudOnUsers>();

            productId = TestInitialiser.context.Products.ToList()[0].Id;
            var viewUser = TestInitialiser.CreateUser();

            username = crudOnUsers.CreateOrUpdateUser(viewUser).Result.UserName;
        }
Ejemplo n.º 3
0
        public async Task <IHttpActionResult> Post([FromBody] ViewUser viewUser)
        {
            try
            {
                var newUSer = await crudOnUsers.CreateOrUpdateUser(viewUser);

                var newViewUser = Mapper.Map <ViewUser>(newUSer);
                return(Ok(newViewUser));
            }
            catch (Exception ex)
            {
                return(throwExceptionToUser.Throw(ex));
            }
        }
Ejemplo n.º 4
0
        public void ShouldAddUser()
        {
            user.UserName = "******";
            user.Email    = "*****@*****.**";
            var donkeySellUser = crudOnUsers.CreateOrUpdateUser(user).Result;

            Assert.IsNotNull(donkeySellUser);
            crudOnUsers.DeleteUser(user.UserName).Wait();
        }
Ejemplo n.º 5
0
        public void Initialize()
        {
            TestInitialiser.Initialise();
            crudOnAlerts = TestInitialiser.ninjectKernel.kernel.Get <ICrudOnAlerts>();
            crudOnUsers  = TestInitialiser.ninjectKernel.kernel.Get <ICrudOnUsers>();
            var viewUser = TestInitialiser.CreateUser();

            user = crudOnUsers.CreateOrUpdateUser(viewUser).Result;
            var viewAlert = new ViewAlert()
            {
                ProductName = productName, UserId = user.UserId
            };

            alert = Mapper.Map <Alert>(viewAlert);
        }