public void AddOrUpdateUser(UserModel user)
 {
     try
     {
         using (var smartTimer = new SmartTimer((x,u) => GatewayLoggerInfo("Exit AddOrUpdateUser", user.Id, x.Elapsed)))
         {
             GatewayLoggerInfo("AddOrUpdateUser", user.Id);
             using (var connection = _provider.Create())
             {
                 connection.Execute("user.AddOrUpdate", new
                 {
                     Id = user.Id,
                     Firstname = user.Firstname,
                     Lastname = user.Lastname,
                     Email = user.Email,
                     Gender = user.Gender,
                     Name = user.Name,
                     Country = user.Country,
                     Lang = user.Lang,
                     Birthday = user.Birthday,
                 }, commandType: CommandType.StoredProcedure);
             }
         }
     }
     catch (System.Exception ex)
     {
         logger.Error(ex);
         throw;
     }
 }
        public void When_update_fake_user()
        {
            var mockedMagicPlaylistGateway = MockedMagicPlaylistGateway
                .Create()
                .CanAddPlaylist(true)
                .AddFastUser(1, "Nicolas", "Delfour", "*****@*****.**");

            var magicPlaylistGateway = mockedMagicPlaylistGateway.Build();

            var user = new UserModel
            {
                Id = 1,
                Firstname = "Toto",
                Lastname = "Tata",
                Email = "*****@*****.**",
                Birthday = "1990-07-22",
                Country = "US",
                Gender = "F",
                Lang = "US",
                Name = "Toto - Tata"
            };

            magicPlaylistGateway.AddOrUpdateUser(user);

            Assert.AreEqual(1, mockedMagicPlaylistGateway._userTable.Count);
        }
        public static MockedMagicPlaylistGateway AddFastUser(this MockedMagicPlaylistGateway mockedMagicPlaylistGateway, 
            int id, string firstname, string lastname, string email)
        {
            var userModel = new UserModel
            {
                Id = id,
                Firstname = firstname,
                Lastname = lastname,
                Email = email,
                Birthday = "1980-02-25",
                Country = "FR",
                Gender = "M",
                Lang = "FR",
                Name = string.Format("{0} - {1}", firstname, lastname)
            };

            return mockedMagicPlaylistGateway.AddUser(userModel);
        }
 public MockedMagicPlaylistGateway AddUser(UserModel userModel)
 {
     _userTable.Add(userModel.Id, userModel);
     return this;
 }