public IUserDTO GetUserByEmailId(string emailId) { IUserDTO userDTO = null; try { using (CasinoPortalEntities context = new CasinoPortalEntities()) { //var userId = context.Employees.Where(m => m.Email == emailId).Select(m => m.EmployeeId).SingleOrDefault(); Player user = context.Players.FirstOrDefault(m => m.EmailId == emailId); // if (user != null) { userDTO = (IUserDTO)DTOFactory.Instance.Create(DTOType.UserDTO); EntityDataModel.EntityConverter.FillDTOFromEntity(user, userDTO); return(userDTO); } } return(userDTO); } catch (Exception ex) { ExceptionManager.HandleException(ex); throw new DACException(ex.Message); } }
// Create Message public IMessageDTO CreateMessage(string text, IUserDTO recipientDTO) { var messageDTO = _messageDTOUnityFactory.Create(); messageDTO.Text = text; messageDTO.Recipient = recipientDTO; return messageDTO; }
public IHttpActionResult Register([FromBody] User user) { user.Created = DateTime.Now; IUserDTO userDTO = (IUserDTO)DTOFactory.Instance.Create(DTOType.UserDTO); EntityConverter.FillDTOFromEntity(user, userDTO); IUserFacade userFacade = (IUserFacade)FacadeFactory.Instance.Create(FacadeType.UserFacade); OperationResult <IUserDTO> result = userFacade.Register(userDTO); if (result.ResultType == OperationResultType.Failure) { string failed = JsonConvert.SerializeObject(new { success = false, data = result.Message }); return(BadRequest(failed)); } if (result.IsValid()) { EntityConverter.FillEntityFromDTO(result.Data, user); string success = JsonConvert.SerializeObject(new { success = true, data = user }); return(Ok(success)); } string jsonObj = JsonConvert.SerializeObject(new { success = false, data = result.Message }); return(BadRequest(jsonObj)); }
/// <summary> /// Post action to login user /// </summary> /// <param name="user"></param> /// <returns></returns> //[HttpPost] //[Route("api/user/login")] public User Login([FromBody] User user) { IUserDTO userDTO = (IUserDTO)DTOFactory.Instance.Create(DTOType.UserDTO); EntityConverter.FillDTOFromEntity(user, userDTO); IUserFacade userFacade = (IUserFacade)FacadeFactory.Instance.Create(FacadeType.UserFacade); OperationResult <IUserDTO> result = userFacade.Login(userDTO); if (result.ResultType == OperationResultType.Failure) { //string failed = JsonConvert.SerializeObject(new { success = false, data = result.Message }); //return BadRequest(failed); return(null); } if (result.IsValid()) { EntityConverter.FillEntityFromDTO(result.Data, user); ////var userStore = new UserStore<ApplicationUser>(new ApplicationDbContext()); ////var manager = new UserManager<ApplicationUser>(userStore); ////var user = new ApplicationUser() { UserName = model.UserName, Email = model.Email } //string success = JsonConvert.SerializeObject(new { success = true, data = user}); //return Ok(success); return(user); } //string jsonObj = JsonConvert.SerializeObject(new { success = false, data = result.Message }); //return BadRequest(jsonObj); return(null); }
public IUserDTO CreateAUser(IUserDTO customer) { IUserDTO createUserRetVal = null; try { using (CasinoPortalEntities context = new CasinoPortalEntities()) { Player user = new Player(); customer.BlockedAmount = 0; customer.AccountBalance = 500; EntityConverter.FillEntityFromDTO(customer, user); context.Players.Add(user); if (context.SaveChanges() > 0) { createUserRetVal = customer; createUserRetVal.PlayerId = user.PlayerId; } } } catch (Exception ex) { ExceptionManager.HandleException(ex); throw new DACException(ex.Message); } return(createUserRetVal); }
public IList <IUserDTO> GetAllUser() { List <IUserDTO> all = null; try { using (CasinoPortalEntities context = new CasinoPortalEntities()) { all = new List <IUserDTO>(); foreach (Player v in context.Players) { IUserDTO userDTO = (IUserDTO)DTOFactory.Instance.Create(DTOType.UserDTO); EntityDataModel.EntityConverter.FillDTOFromEntity(v, userDTO); all.Add(userDTO); } return(all); } } catch (Exception exception) { ExceptionManager.HandleException(exception); throw new DACException(exception.Message); } }
public bool Update(IUserDTO dto) { int index = users.FindIndex(i => i.Id == dto.Id); users[index] = dto; return(true); }
public IUserDTO AddUserMoney(string emailId, decimal rechargeAmount) { IUserDTO userDTO = null; try { //userDTO = GetUserByEmailId(emailId); //userDTO.AccountBalance+=rechargeAmount; using (CasinoPortalEntities context = new CasinoPortalEntities()) { //var userId = context.Employees.Where(m => m.Email == emailId).Select(m => m.EmployeeId).SingleOrDefault(); Player user = context.Players.FirstOrDefault(m => m.EmailId == emailId); if (user != null) { user.AccountBalance += rechargeAmount; userDTO = (IUserDTO)DTOFactory.Instance.Create(DTOType.UserDTO); EntityDataModel.EntityConverter.FillDTOFromEntity(user, userDTO); if (context.SaveChanges() > 0) { return(userDTO); } return(userDTO); } } return(userDTO); } catch (Exception ex) { ExceptionManager.HandleException(ex); throw new DACException(ex.Message); } }
public IUserDTO UpdateUser(IUserDTO userDTO) { try { CasinoPortalEntities context = new CasinoPortalEntities(); using (context) { var amount = userDTO.AccountBalance; var foundItem = context.Users.ToList().Where(item => item.UserID == userDTO.UserID).FirstOrDefault(); if (foundItem != null) { EntityConverter.FillDTOFromEntity(foundItem, userDTO); foundItem.AccountBalance += amount; context.SaveChanges(); } } } catch (Exception ex) { ExceptionManager.HandleException(ex); throw new DACException(ex.Message); } return(userDTO); }
public IUserDTO CreateUser(IUserDTO userDTO) { IUserDTO retVal = null; try { using (CasinoPortalEntities context = new CasinoPortalEntities()) { userDTO.BlockedAmount = 0; userDTO.AccountBalance = 500; userDTO.UniqueUserId = RandomString(8); User user = new User(); EntityConverter.FillEntityFromDTO(userDTO, user); context.Users.Add(user); context.SaveChanges(); userDTO.UserID = user.UserID; retVal = userDTO; } } catch (Exception ex) { ExceptionManager.HandleException(ex); throw new DACException(ex.Message); } return(retVal); }
public LoggedUser( IUserDTO userDTO, ICredentialsAccessor credentialsAccessor, ITimelineController timelineController, ITweetController tweetController, ITweetFactory tweetFactory, IUserController userController, IMessageController messageController, IFriendshipFactory friendshipFactory, IFriendshipController friendshipController, IAccountController accountController, ISavedSearchController savedSearchController) : base(userDTO, timelineController, userController, friendshipFactory) { _credentialsAccessor = credentialsAccessor; _tweetController = tweetController; _tweetFactory = tweetFactory; _messageController = messageController; _friendshipController = friendshipController; _accountController = accountController; _savedSearchController = savedSearchController; Credentials = _credentialsAccessor.CurrentThreadCredentials; }
private void FieldsValidate(IUserDTO user) { if (user == null) { throw new Exception(string.Format(FieldsRequired.FieldsAreRequired)); } if (string.IsNullOrEmpty(user.FirstName)) { throw new Exception(string.Format(FieldsRequired.FieldRe, "FirstName")); } if (string.IsNullOrEmpty(user.LastName)) { throw new Exception(string.Format(FieldsRequired.FieldRe, "LastName")); } if (string.IsNullOrEmpty(user.Adress)) { throw new Exception(string.Format(FieldsRequired.FieldRe, "Adress")); } if (string.IsNullOrEmpty(user.Phone)) { throw new Exception(string.Format(FieldsRequired.FieldRe, "Phone")); } if (string.IsNullOrEmpty(user.Email)) { throw new Exception(string.Format(FieldsRequired.FieldRe, "Email")); } }
private static void UpdateUser() { Console.Write("\nEnter User ID: "); userDTO.UserId = int.Parse(Console.ReadLine()); Console.Write("\nEnter User Name : "); userDTO.Name = Console.ReadLine(); Console.Write("\nEnter User Age: "); string age = Console.ReadLine(); if (age != "" && age.Trim() != "") { userDTO.Age = int.Parse(age); } else { userDTO.Age = -1; } Console.Write("\nEnter User Gender: "); userDTO.Gender = Console.ReadLine(); if (userBDC.UpdateUser(userDTO)) { Console.WriteLine("User successfully updated with ID: {0}", userDTO.UserId); IUserDTO retrievedUserDTO = userBDC.GetAUser(userDTO.UserId); PrintJSONifyUserDTO(retrievedUserDTO); } else { Console.WriteLine("Operation could not be successful. Please try again."); } }
public OperationResult<long> CreateUser(IUserDTO userDto) { OperationResult<long> operationResult = null; try { var userDAC = (IUserDAC)DACFactory.Instance.Create(DACType.User); var resultUserDto = userDto.UserId > 0 ? userDAC.UpdateUser(userDto) : userDAC.CreateUser(userDto); operationResult = resultUserDto != null ? OperationResult<long>.CreateSuccessResult(resultUserDto) : OperationResult<long>.CreateFailureResult( ResourceUtility.GetCaptionFor( ResourceConstants.Vendor.ErrorMessages.FailedToFetchListing));//todo messages } catch (DACException dacEx) { operationResult = OperationResult<long>.CreateErrorResult(dacEx.Message, dacEx.StackTrace); } catch (Exception ex) { ExceptionManager.HandleException(ex); operationResult = OperationResult<long>.CreateErrorResult(ex.Message, ex.StackTrace); } return operationResult; }
public AuthenticatedUser( IUserDTO userDTO, ICredentialsAccessor credentialsAccessor, ITimelineController timelineController, ITweetController tweetController, IUserController userController, IMessageController messageController, IFriendshipController friendshipController, IAccountController accountController, ITwitterListController twitterListController, ISavedSearchController savedSearchController, ITaskFactory taskFactory) : base(userDTO, userController, timelineController, friendshipController, twitterListController, taskFactory) { _credentialsAccessor = credentialsAccessor; _tweetController = tweetController; _messageController = messageController; _friendshipController = friendshipController; _accountController = accountController; _twitterListController = twitterListController; _savedSearchController = savedSearchController; Credentials = _credentialsAccessor.CurrentThreadCredentials; }
private IUserDTO SetBoolsBasedOnRelationshipState(Relationship relationship, IUserDTO user) { var state = relationship.RelationshipState; switch (state) { case (RelationshipStates.BLOCKED): user.IsBlocked = true; user.IsPending = false; user.IsFriend = false; break; case (RelationshipStates.CONFIRMED): user.IsBlocked = false; user.IsPending = false; user.IsFriend = true; break; case (RelationshipStates.PENDING): user.IsBlocked = false; user.IsPending = true; user.IsFriend = false; break; case (RelationshipStates.UNKNOWN): user.IsBlocked = false; user.IsPending = false; user.IsFriend = false; break; } return(user); }
/// <summary> /// Method to register user /// </summary> /// <param name="userDTO"></param> /// <returns></returns> public OperationResult <IUserDTO> Register(IUserDTO userDTO) { OperationResult <IUserDTO> retVal = null; try { IUserDAC userDAC = (IUserDAC)DACFactory.Instance.Create(DACType.UserDAC); IUserDTO resultDTO = userDAC.Register(userDTO); if (resultDTO != null) { retVal = OperationResult <IUserDTO> .CreateSuccessResult(resultDTO); } else { retVal = OperationResult <IUserDTO> .CreateFailureResult("Email Id already exist!"); } } catch (DACException dacEx) { retVal = OperationResult <IUserDTO> .CreateErrorResult(dacEx.Message, dacEx.StackTrace); } catch (Exception ex) { ExceptionManager.HandleException(ex); retVal = OperationResult <IUserDTO> .CreateErrorResult(ex.Message, ex.StackTrace); } return(retVal); }
public IList <IUserDTO> GetAll() { IList <IUserDTO> tempUserList = new List <IUserDTO>(); try { CasinoPortalEntities context = new CasinoPortalEntities(); using (context) { var items = context.Users.ToList(); foreach (var eachItem in items) { IUserDTO userDTO = (IUserDTO)DTOFactory.Instance.Create(DTOType.UserDTO); EntityConverter.FillDTOFromEntity(eachItem, userDTO); tempUserList.Add(userDTO); } } } catch (Exception ex) { ExceptionManager.HandleException(ex); throw new DACException(ex.Message); } return(tempUserList); }
public UserModel GetUser(string id) { IUserDTO userDTO = (IUserDTO)DTOFactory.Instance.Create(DTOType.UserDTO); UserModel model = new UserModel(); List <UserModel> list = new List <UserModel>(); IUserFacade userFacade = (IUserFacade)FacadeFactory.Instance.Create(FacadeType.UserFacade); OperationResult <IList <IUserDTO> > result = userFacade.GetAllUsers(); if (result.IsValid()) { foreach (var user in result.Data) { if (user.Unique_User_Id == id) { model.Contact_Number = user.Contact_Number; model.Customer_Name = user.Customer_Name; model.Account_Balance = user.Account_Balance; model.Email_Id = user.Email_Id; model.Blocked_Amount = user.Blocked_Amount; model.Unique_User_Id = user.Unique_User_Id; } } } return(model); }
public static IUser GenerateUser(IUserDTO userDTO) { var user = A.Fake <IUser>(); A.CallTo(() => user.UserDTO).Returns(userDTO); return(user); }
public OperationResult <IUserDTO> UpdateProfile(IUserDTO userDTO) { OperationResult <IUserDTO> updateProfileReturnValue = null; try { EmployeePortalValidationResult validationResult = Validator <UserValidator, IUserDTO> .Validate(userDTO, ValidationConstants.CommomUservalidations); if (!validationResult.IsValid) { updateProfileReturnValue = OperationResult <IUserDTO> .CreateFailureResult(validationResult); } else { IUserDAC userDAC = (IUserDAC)DACFactory.Instance.Create(DACType.UserManagerDAC); IUserDTO returnedUserDTO = userDAC.UpdateProfile(userDTO); if (returnedUserDTO != null) { updateProfileReturnValue = OperationResult <IUserDTO> .CreateSuccessResult(returnedUserDTO, "Profile updated successfully"); } } } catch (DACException dacEx) { updateProfileReturnValue = OperationResult <IUserDTO> .CreateErrorResult(dacEx.Message, dacEx.StackTrace); } catch (Exception ex) { ExceptionManager.HandleException(ex); updateProfileReturnValue = OperationResult <IUserDTO> .CreateErrorResult(ex.Message, ex.StackTrace); } return(updateProfileReturnValue); }
public IList <IUserDTO> SearchUser(string nameSearch, string contactSearch, string emailSearch) { IList <IUserDTO> returnedList = null; try { using (CasinoPortalEntities context = new CasinoPortalEntities()) { IList <SearchEmployee_Result> userList = new List <SearchEmployee_Result>(); userList = (IList <SearchEmployee_Result>)context.SearchEmployee(nameSearch, emailSearch, contactSearch).ToList(); if (userList.Count > 0) { returnedList = new List <IUserDTO>(); foreach (var user in userList) { IUserDTO userDTO = (IUserDTO)DTOFactory.Instance.Create(DTOType.UserDTO); EntityDataModel.EntityConverter.FillDTOFromEntity(user, userDTO); returnedList.Add(userDTO); } } } } catch (Exception exception) { ExceptionManager.HandleException(exception); throw new DACException(exception.Message); } return(returnedList); }
public OperationResult <IUserDTO> GetUserByEmailId(string emailId) { OperationResult <IUserDTO> getUserReturnValue = null; try { IUserDAC userDAC = (IUserDAC)DACFactory.Instance.Create(DACType.UserManagerDAC); IUserDTO userDTO = userDAC.GetUserByEmailId(emailId); if (userDTO != null) { getUserReturnValue = OperationResult <IUserDTO> .CreateSuccessResult(userDTO); } else { getUserReturnValue = OperationResult <IUserDTO> .CreateFailureResult("Get User By Email Id Method Failed"); } } catch (DACException dacEx) { getUserReturnValue = OperationResult <IUserDTO> .CreateErrorResult(dacEx.Message, dacEx.StackTrace); } catch (Exception ex) { ExceptionManager.HandleException(ex); getUserReturnValue = OperationResult <IUserDTO> .CreateErrorResult(ex.Message, ex.StackTrace); } return(getUserReturnValue); }
public IUserDTO GetUserByContactNumber(string contactNumber) { IUserDTO userDTO = null; try { using (CasinoPortalEntities context = new CasinoPortalEntities()) { Player user = context.Players.FirstOrDefault(m => m.ContactNumber == contactNumber); if (user != null) { userDTO = (IUserDTO)DTOFactory.Instance.Create(DTOType.UserDTO); EntityDataModel.EntityConverter.FillDTOFromEntity(user, userDTO); return(userDTO); } } return(userDTO); } catch (Exception ex) { ExceptionManager.HandleException(ex); throw new DACException(ex.Message); } }
public IHttpActionResult GetProfile(int id) { IUserDTO userDTO = (IUserDTO)DTOFactory.Instance.Create(DTOType.UserDTO); userDTO.Id = id; IUserFacade userFacade = (IUserFacade)FacadeFactory.Instance.Create(FacadeType.UserFacade); OperationResult <IUserDTO> result = userFacade.GetProfile(userDTO); if (result.ResultType == OperationResultType.Failure) { string failed = JsonConvert.SerializeObject(new { success = false, data = result.Message }); return(BadRequest(failed)); } if (result.IsValid()) { User user = new User(); EntityConverter.FillEntityFromDTO(result.Data, user); string success = JsonConvert.SerializeObject(new { success = true, data = user }); return(Ok(success)); } string jsonObj = JsonConvert.SerializeObject(new { success = false, data = result.Message }); return(BadRequest(jsonObj)); }
public IUserDTO AddWinningPrize(string emailId, decimal betAmount, decimal multiplyFactor) { IUserDTO userDTO = null; try { using (CasinoPortalEntities context = new CasinoPortalEntities()) { Player user = context.Players.FirstOrDefault(m => m.EmailId == emailId); if (user != null) { user.AccountBalance += (decimal)(user.BlockedAmount * multiplyFactor); user.BlockedAmount = 0; userDTO = (IUserDTO)DTOFactory.Instance.Create(DTOType.UserDTO); EntityDataModel.EntityConverter.FillDTOFromEntity(user, userDTO); if (context.SaveChanges() > 0) { return(userDTO); } } } return(userDTO); } catch (Exception ex) { ExceptionManager.HandleException(ex); throw new DACException(ex.Message); } }
public ActionResult CreateAUser(UserViewModels user) { IUserFacade customerFacade = (IUserFacade)FacadeFactory.Instance.Create(FacadeType.UserFacade); IUserDTO createCustomerDTO = (IUserDTO)DTOFactory.Instance.Create(DTOType.UserDTO); HttpPostedFileBase file = Request.Files["ImageData"]; user.IdentityProof = convertToBytes(file); if (ModelState.IsValid) { DTOConverter.FillDTOFromViewModel(createCustomerDTO, user); OperationResult <IUserDTO> resultCreate = customerFacade.CreateAUser(createCustomerDTO); if (resultCreate.IsValid()) { return(View("../Home/Index")); } else { IList <AdminPortalValidationFailure> resultFail = resultCreate.ValidationResult.Errors; foreach (var item in resultFail) { ModelState.AddModelError(item.PropertyName, item.ErrorMessage); } return(View()); } } return(View()); }
public OperationResult <IUserDTO> CreateUser(IUserDTO userDTO) { IUserBDC userBDC = (IUserBDC)BDCFactory.Instance.Create(BDCType.UserBDC); return(userBDC.CreateUser(userDTO)); //throw new NotImplementedException(); }
public static IUser GenerateUser(IUserDTO userDTO) { var user = A.Fake <IUser>(); user.CallsTo(x => x.UserDTO).Returns(userDTO); return(user); }
public IUserDTO CreateUser(IUserDTO userDTO) { var userExists = _context.Users .FirstOrDefault(u => u.UserName == userDTO.UserName); if (userExists != null) { throw new ArgumentException("A user with that name already exists."); } var emailExists = _context.Users .FirstOrDefault(u => u.Email == userDTO.Email); if (emailExists != null) { throw new ArgumentException("A user with that email is already registered."); } var user = new User { UserName = userDTO.UserName, Email = userDTO.Email, IsBanned = userDTO.IsBanned, BanReason = userDTO.BanReason }; _context.Users.Add(user); _context.SaveChanges(); return(userDTO); }
private static void FillDetailsOfLoggedInUser(IUserDTO loginResult, UserInfo userInfo) { FormsAuthentication.SetAuthCookie(loginResult.EmployeeDTO.Email, false); DTOConverter.FillViewModelFromDTO(userInfo, loginResult); userInfo.Employee = new EmployeeInfo(); DTOConverter.FillViewModelFromDTO(userInfo.Employee, loginResult.EmployeeDTO); }
static void UpdateProfile() { IUserDTO userDTO = (IUserDTO)DTOFactory.Instance.Create(DTOType.UserDTO); userDTO.EmployeeDTO = (IEmployeeDTO)DTOFactory.Instance.Create(DTOType.EmployeeDTO); userDTO.IsAdmin = true; userDTO.Password = "******"; userDTO.UserId = 6; userDTO.EmployeeId = 6; userDTO.EmployeeDTO.EmployeeId = 6; userDTO.EmployeeDTO.FirstName = "Gaurav"; userDTO.EmployeeDTO.LastName = "Arora"; userDTO.EmployeeDTO.Email = "*****@*****.**"; userDTO.EmployeeDTO.DateOfJoining = DateTime.Now.Date; //userDTO.EmployeeDTO.TerminationDate = DateTime.Now.AddDays(2); userDTO.EmployeeDTO.DepartmentId = 1; IUserFacade userFacade = (IUserFacade)FacadeFactory.Instance.Create(FacadeType.UserManagerFacade); OperationResult <IUserDTO> createEmployeeRetVal = userFacade.UpdateProfile(userDTO); if (createEmployeeRetVal.IsValid()) { System.Console.WriteLine("Updated!! Emp Id : {0} User Id : {1}", createEmployeeRetVal.Data.EmployeeId, createEmployeeRetVal.Data.UserId); } }
private void InitData() { _fakeHomeTimelineParameters = A.Fake<IHomeTimelineParameters>(); _fakeUserTimelineParameters = A.Fake<IUserTimelineParameters>(); _fakeMentionsTimelineParameters = A.Fake<IMentionsTimelineParameters>(); _fakeUserTimelineQueryParameters = A.Fake<IUserTimelineQueryParameters>(); _maximuNumberOfTweets = TestHelper.GenerateRandomInt(); _resultDTO = new List<ITweetDTO>(); _result = new List<ITweet>(); _userName = TestHelper.GenerateString(); _userId = TestHelper.GenerateRandomLong(); _fakeUser = A.Fake<IUser>(); _fakeUserDTO = A.Fake<IUserDTO>(); _fakeUserIdentifier = _fakeUserDTO; }
/// <summary> /// /// </summary> /// <param name="userDto"></param> /// <returns></returns> public long CreateUser(IUserDTO userDto) { var retVal = -1L;//public const int DefaultCreateId = -1; todo add this to Global constants try { if (userDto != null) { using (TransactionScope trans = new TransactionScope()) { using (var TMCDbContext = new TMCContext()) { var user = new User(); EntityConverter.FillEntityFromDTO(userDto, user); user.CreatedOn = DateTime.Now; user.CreatedBy = 11;//todo user.UpdatedOn = DateTime.Now; user.UpdatedBy = 11; user.IsActive = true; user.IsDeleted = false; user.UserTypeId = 1; user.AddressLine1 = "Default AddressLine1"; user.PinCode = 12345; TMCDbContext.User.AddObject(user); if (TMCDbContext.SaveChanges() > 0) { retVal = user.UserId; //userDto.ListingId = listing.ListingId; } } trans.Complete(); } } } catch (Exception ex) { ExceptionManager.HandleException(ex); throw new DACException("Error while creating the user.", ex); } return retVal; }
public OperationResult<long> CreateUser(IUserDTO userDto) { var userBDC = (IUserBDC)BDCFactory.Instance.Create(BDCType.User); return userBDC.CreateUser(userDto); }
public User( IUserDTO userDTO, IUserController userController, ITimelineController timelineController, IFriendshipController friendshipController, ITwitterListController twitterListController, ITaskFactory taskFactory) { _userDTO = userDTO; _timelineController = timelineController; _userController = userController; _friendshipController = friendshipController; _twitterListController = twitterListController; _taskFactory = taskFactory; }
private void ArrangeUpdateRelationshipAuthorizationsWithDTO(IUserDTO userDTO, bool retweetsEnabled, bool notification, bool returnValue) { _fakeFriendshipQueryExecutor .CallsTo(x => x.UpdateRelationshipAuthorizationsWith(userDTO, A<IFriendshipAuthorizations>.That.Matches(a => a.RetweetsEnabled == retweetsEnabled && a.DeviceNotificationEnabled == notification))) .Returns(returnValue); }
private void ArrangeDestroyFriendshipWithDTO(IUserDTO userDTO, bool returnValue) { _fakeFriendshipQueryExecutor .CallsTo(x => x.DestroyFriendshipWith(userDTO)) .Returns(returnValue); }
private void ArrangeGetUpdateRelationshipAuthorizationQuery(IUserDTO userDTO, IFriendshipAuthorizations authorizations, string query) { _fakeFriendshipQueryGenerator .CallsTo(x => x.GetUpdateRelationshipAuthorizationsWithQuery(userDTO, A<IFriendshipAuthorizations>.That.Matches(a => a.RetweetsEnabled == authorizations.RetweetsEnabled && a.DeviceNotificationEnabled == authorizations.DeviceNotificationEnabled))) .Returns(query); }
public static async Task<IUser> GenerateUserFromDTO(IUserDTO userDTO) { return await Sync.ExecuteTaskAsync(() => User.GenerateUserFromDTO(userDTO)); }
private void ArrangeDestroyFriendshipWithUserDTO(IUserDTO userDTO, string query) { _fakeFriendshipQueryGenerator .CallsTo(x => x.GetDestroyFriendshipWithQuery(userDTO)) .Returns(query); }
/// <summary> /// Destroy a list /// </summary> public static bool DestroyList(string slug, IUserDTO ownerDTO) { return TwitterListController.DestroyList(slug, ownerDTO); }
private string ArrangeUpdateRelationshipAuthorizations_UserDTO(IUserDTO userDTO, bool retweetsEnabled, bool notification, string returnValue) { // Arrange var query = Guid.NewGuid().ToString(); var jsonController = CreateFriendshipJsonController(); var fakeAuthorizations = GenerateFriendshipAuthorizations(retweetsEnabled, notification); ArrangeGetUpdateRelationshipAuthorizationQuery(userDTO, fakeAuthorizations, query); _fakeTwitterAccessor.ArrangeExecuteJsonPOSTQuery(query, returnValue); // Act return jsonController.UpdateRelationshipAuthorizationsWith(userDTO, retweetsEnabled, notification); }
public static async Task<bool> DestroyList(string slug, IUserDTO ownerDTO) { return await Sync.ExecuteTaskAsync(() => TwitterList.DestroyList(slug, ownerDTO)); }
// Stream Profile Image public Stream GetProfileImageStream(IUserDTO userDTO, ImageSize imageSize = ImageSize.normal) { var url = _userQueryGenerator.DownloadProfileImageURL(userDTO, imageSize); return _webHelper.GetResponseStream(url); }
public static IUser GenerateUserFromDTO(IUserDTO userDTO) { return UserFactory.GenerateUserFromDTO(userDTO); }
public static async Task<System.IO.Stream> GetProfileImageStream(IUserDTO userDTO, ImageSize imageSize = ImageSize.normal) { return await Sync.ExecuteTaskAsync(() => User.GetProfileImageStream(userDTO, imageSize)); }
public IUser GenerateUserFromDTO(IUserDTO userDTO) { if (userDTO == null) { return null; } var parameterOverride = _userUnityFactory.GenerateParameterOverrideWrapper("userDTO", userDTO); var user = _userUnityFactory.Create(parameterOverride); return user; }
private void ArrangeUpdateRelationshipAuthorizationsWithUserDTO(IUserDTO userDTO, IFriendshipAuthorizations auth, string query) { _fakeFriendshipQueryGenerator .CallsTo(x => x.GetUpdateRelationshipAuthorizationsWithQuery(userDTO, auth)) .Returns(query); }
public static IUser GenerateUser(IUserDTO userDTO) { var user = A.Fake<IUser>(); user.CallsTo(x => x.UserDTO).Returns(userDTO); return user; }
public string DownloadProfileImageInHttpURL(IUserDTO userDTO, ImageSize imageSize = ImageSize.normal) { var url = userDTO.ProfileImageUrl; if (String.IsNullOrEmpty(url)) { return null; } return url.Replace("_normal", String.Format("_{0}", imageSize)); }
private void ArrangeQueryGeneratorPublishMessage(string text, IUserDTO targetUserDTO, string query) { _fakeMessageQueryGenerator .CallsTo(x => x.GetPublishMessageQuery(text, targetUserDTO)) .Returns(query); }
private void VerifyUpdateRelationshipAuthorizationsWithDTO(IUserDTO userDTO, bool retweetsEnabled, bool notification) { _fakeFriendshipQueryExecutor .CallsTo(x => x.UpdateRelationshipAuthorizationsWith(userDTO, A<IFriendshipAuthorizations>.That.Matches(a => a.RetweetsEnabled == retweetsEnabled && a.DeviceNotificationEnabled == notification))) .MustHaveHappened(Repeated.Exactly.Once); }
public static System.IO.Stream GetProfileImageStream(IUserDTO userDTO, ImageSize imageSize = ImageSize.normal) { return UserController.GetProfileImageStream(userDTO, imageSize); }
private void ArrangeQueryExecutorPublishMessageWithTextAndUserDTO(string text, IUserDTO recipient, IMessageDTO result) { _fakeMessageQueryExecutor .CallsTo(x => x.PublishMessage(text, recipient)) .Returns(result); }
public Stream GetProfileImageStream(IUserDTO userDTO, ImageSize imageSize = ImageSize.normal) { return _userQueryExecutor.GetProfileImageStream(userDTO, imageSize); }
/// <summary> /// Ctor /// </summary> /// <param name="name"></param> public JCCIdentity(IUserDTO loggedInUser) { LoggedInUser = loggedInUser; }