public ProfileInformationDTO GetProfileInformation(Token token, GetProfileInformationCriteria criteria) { var securityInfo = SecurityManager.EnsureAuthentication(token); ProfileService profileService = new ProfileService(Session, securityInfo, Configuration, SecurityManager, PushNotificationService, EMailService); return(profileService.GetProfileInformation(token, criteria)); }
public void TestFriends_PrivacyPrivate() { setFriendsPrivacy(Privacy.Private); ProfileInformationDTO profileInfo = null; var profile0 = (ProfileDTO)profiles[0].Tag; var profile1 = (ProfileDTO)profiles[1].Tag; var profile2 = (ProfileDTO)profiles[2].Tag; SessionData data = CreateNewSession(profile1, ClientInformation); GetProfileInformationCriteria criteria = new GetProfileInformationCriteria(); criteria.UserId = profile0.GlobalId; RunServiceMethod(delegate(InternalBodyArchitectService Service) { profileInfo = Service.GetProfileInformation(data.Token, criteria); }); Assert.AreEqual(0, profileInfo.Friends.Count); data = CreateNewSession(profile2, ClientInformation); RunServiceMethod(delegate(InternalBodyArchitectService Service) { profileInfo = Service.GetProfileInformation(data.Token, criteria); }); Assert.AreEqual(0, profileInfo.Friends.Count); }
public void TestFavoritesUsers_Others() { profiles[0].FavoriteUsers.Add(profiles[1]); insertToDatabase(profiles[0]); var profile0 = (ProfileDTO)profiles[1].Tag; var profile1 = (ProfileDTO)profiles[2].Tag; GetProfileInformationCriteria criteria = new GetProfileInformationCriteria(); criteria.UserId = profiles[0].GlobalId; SessionData data = CreateNewSession(profile0, ClientInformation); RunServiceMethod(delegate(InternalBodyArchitectService Service) { var profileInfo = Service.GetProfileInformation(data.Token, criteria); Assert.AreEqual(0, profileInfo.FavoriteUsers.Count); }); data = CreateNewSession(profile1, ClientInformation); RunServiceMethod(delegate(InternalBodyArchitectService Service) { var profileInfo = Service.GetProfileInformation(data.Token, criteria); Assert.AreEqual(0, profileInfo.FavoriteUsers.Count); }); }
public void TestWymiary_PrivacyPrivate() { setSizesPrivacy(Privacy.Private); ProfileInformationDTO profileInfo = null; var profile0 = (ProfileDTO)profiles[0].Tag; var profile1 = (ProfileDTO)profiles[1].Tag; var profile2 = (ProfileDTO)profiles[2].Tag; SessionData data = SecurityManager.CreateNewSession(profile1, ClientInformation); GetProfileInformationCriteria criteria = new GetProfileInformationCriteria(); criteria.UserId = profile0.Id; RunServiceMethod(delegate(InternalBodyArchitectService Service) { profileInfo = Service.GetProfileInformation(data.Token, criteria); }); Assert.IsNull(profileInfo.Wymiary); data = SecurityManager.CreateNewSession(profile2, ClientInformation); RunServiceMethod(delegate(InternalBodyArchitectService Service) { profileInfo = Service.GetProfileInformation(data.Token, criteria); }); Assert.IsNull(profileInfo.Wymiary); }
public void TestWymiary_PrivacyPublic() { setSizesPrivacy(Privacy.Public); var profile0 = (ProfileDTO)profiles[0].Tag; var profile1 = (ProfileDTO)profiles[1].Tag; var profile2 = (ProfileDTO)profiles[2].Tag; SessionData data = CreateNewSession(profile1, ClientInformation); GetProfileInformationCriteria criteria = new GetProfileInformationCriteria(); criteria.UserId = profile0.GlobalId; ProfileInformationDTO profileInfo = null; RunServiceMethod(delegate(InternalBodyArchitectService Service) { profileInfo = Service.GetProfileInformation(data.Token, criteria); }); Assert.IsNotNull(profileInfo.Wymiary); Assert.AreEqual(100, profileInfo.Wymiary.Height); data = CreateNewSession(profile2, ClientInformation); RunServiceMethod(delegate(InternalBodyArchitectService Service) { profileInfo = Service.GetProfileInformation(data.Token, criteria); }); Assert.IsNotNull(profileInfo.Wymiary); Assert.AreEqual(100, profileInfo.Wymiary.Height); }
public void Records_Myselft() { var exercise = CreateExercise(Session, null, "ex1", "ex1"); exercise.UseInRecords = true; insertToDatabase(exercise); var exercise1 = CreateExercise(Session, null, "ex2", "ex2"); CreateExerciseRecord(exercise, profiles[0], new Tuple <int, decimal>(2, 50), DateTime.UtcNow.Date.AddDays(-3)); CreateExerciseRecord(exercise1, profiles[0], new Tuple <int, decimal>(12, 150), DateTime.UtcNow.Date.AddDays(-13)); var profile0 = (ProfileDTO)profiles[0].Tag; SessionData data = CreateNewSession(profile0, ClientInformation); GetProfileInformationCriteria criteria = new GetProfileInformationCriteria(); RunServiceMethod(delegate(InternalBodyArchitectService service) { var profileInfo = service.GetProfileInformation(data.Token, criteria); Assert.AreEqual(1, profileInfo.Records.Count); Assert.AreEqual(null, profileInfo.Records[0].CustomerId); Assert.AreEqual(exercise.GlobalId, profileInfo.Records[0].Exercise.GlobalId); Assert.AreEqual(50, profileInfo.Records[0].MaxWeight); Assert.AreEqual(2, profileInfo.Records[0].Repetitions); Assert.AreEqual(DateTime.UtcNow.Date.AddDays(-3), profileInfo.Records[0].TrainingDate); Assert.AreNotEqual(Guid.Empty, profileInfo.Records[0].SerieId); }); }
public void TestBirthdayDate_PrivacyPublic() { setBirthdayPrivacy(Privacy.Public); var profile0 = (ProfileDTO)profiles[0].Tag; var profile1 = (ProfileDTO)profiles[1].Tag; var profile2 = (ProfileDTO)profiles[2].Tag; SessionData data = CreateNewSession(profile1, ClientInformation); GetProfileInformationCriteria criteria = new GetProfileInformationCriteria(); criteria.UserId = profile0.GlobalId; ProfileInformationDTO profileInfo = null; RunServiceMethod(delegate(InternalBodyArchitectService Service) { profileInfo = Service.GetProfileInformation(data.Token, criteria); }); Assert.IsTrue(UnitTestHelper.CompareDateTime(profile0.Birthday, profileInfo.Birthday.Value)); data = CreateNewSession(profile2, ClientInformation); RunServiceMethod(delegate(InternalBodyArchitectService Service) { profileInfo = Service.GetProfileInformation(data.Token, criteria); }); Assert.IsTrue(UnitTestHelper.CompareDateTime(profile0.Birthday, profileInfo.Birthday.Value)); }
public static ProfileInformationDTO GetProfileInformation(GetProfileInformationCriteria criteria) { return(exceptionHandling(delegate { return Instance.GetProfileInformation(Token, criteria); })); }
public void TestInvitations_Others() { FriendInvitation invitation = new FriendInvitation(); invitation.Inviter = profiles[0]; invitation.Invited = profiles[1]; invitation.InvitationType = FriendInvitationType.Invite; invitation.CreateDate = DateTime.UtcNow; insertToDatabase(invitation); var profile0 = (ProfileDTO)profiles[1].Tag; var profile1 = (ProfileDTO)profiles[2].Tag; GetProfileInformationCriteria criteria = new GetProfileInformationCriteria(); criteria.UserId = profiles[0].GlobalId; SessionData data = CreateNewSession(profile0, ClientInformation); RunServiceMethod(delegate(InternalBodyArchitectService Service) { var profileInfo = Service.GetProfileInformation(data.Token, criteria); Assert.AreEqual(0, profileInfo.Invitations.Count); }); data = CreateNewSession(profile1, ClientInformation); RunServiceMethod(delegate(InternalBodyArchitectService Service) { var profileInfo = Service.GetProfileInformation(data.Token, criteria); Assert.AreEqual(0, profileInfo.Invitations.Count); }); }
static async public Task <ProfileInformationDTO> GetProfileInformationAsync(GetProfileInformationCriteria criteria) { var test = exceptionHandling((client) => { return(Task <ProfileInformationDTO> .Factory.FromAsync(client.BeginGetProfileInformation, client.EndGetProfileInformation, ApplicationState.Current.SessionData.Token, criteria, null)); }); return(await test); }
public void Fill(UserDTO user) { if (currentTask != null) { currentTask.Cancel(); currentTask = null; updateButtons(false); } this.ClearContent(); showProgress(true); currentTask = ParentWindow.TasksManager.RunAsynchronousOperation(delegate(OperationContext ctx) { GetProfileInformationCriteria criteria = new GetProfileInformationCriteria(); criteria.UserId = user.Id; ProfileInformationDTO usr; if (user.IsMe()) { usr = UserContext.ProfileInformation; } else { usr = ServiceManager.GetProfileInformation(criteria); } if (ctx.CancellatioToken.IsCancellationRequested) { return; } this.user = usr; ParentWindow.SynchronizationContext.Send(delegate { foreach (NaviBand band in naviBar1.Bands) { if (ctx.CancellatioToken.IsCancellationRequested) { return; } if (band.ClientArea.Controls.Count > 0) { IUserDetailControl ctrl = band.ClientArea.Controls[0] as IUserDetailControl; if (ctrl != null) { ctrl.Fill(this.user, naviBar1.ActiveBand == band); band.Text = ctrl.Caption; } } } //updateButtons(); //without these caption of navi bar was not refreshed in some cases naviBar1.Refresh(); naviBar1.Update(); showProgress(false); }, null); }, asyncOperationStateChange, null, false); }
public void Fill(UserDTO user) { if (currentTask != null) { currentTask.Cancel(); currentTask = null; updateButtons(false); } this.ClearContent(); if (accordionCtrl.SelectedItem == null) { ShowUserInfo(); } showProgress(true); currentTask = ParentWindow.RunAsynchronousOperation(delegate(OperationContext ctx) { GetProfileInformationCriteria criteria = new GetProfileInformationCriteria(); criteria.UserId = user.GlobalId; ProfileInformationDTO usr; if (user.IsMe()) { usr = UserContext.Current.ProfileInformation; } else { usr = ServiceManager.GetProfileInformation(criteria); } if (ctx.CancellatioToken.IsCancellationRequested) { return; } this.user = usr; UIHelper.BeginInvoke(new Action(delegate { foreach (AccordionItem band in accordionCtrl.Items) { if (ctx.CancellatioToken.IsCancellationRequested) { return; } if (band.Content != null) { IUserDetailControl ctrl = band.Content as IUserDetailControl; if (ctrl != null) { ctrl.Fill(this.user, accordionCtrl.SelectedItem == band); } } } updateButtons(false); showProgress(false); }), Dispatcher); }, asyncOperationStateChange, null); }
public void TestGetProfileInformations_WithRejectedFriendship() { ProfileDTO inviter = (ProfileDTO)profiles[0].Tag; ProfileDTO invited = (ProfileDTO)profiles[1].Tag; SessionData data = SecurityManager.CreateNewSession(inviter, ClientInformation); RunServiceMethod(delegate(InternalBodyArchitectService Service) { var arg = new InviteFriendOperationData(); arg.User = invited; arg.Operation = InviteFriendOperation.Invite; Service.InviteFriendOperation(data.Token, arg); }); data = SecurityManager.CreateNewSession(invited, ClientInformation); RunServiceMethod(delegate(InternalBodyArchitectService Service) { var arg = new InviteFriendOperationData(); arg.User = inviter; arg.Operation = InviteFriendOperation.Accept; Service.InviteFriendOperation(data.Token, arg); }); int count = Session.QueryOver <FriendInvitation>().RowCount(); Assert.AreEqual(0, count); //reject friendship RunServiceMethod(delegate(InternalBodyArchitectService Service) { var arg = new InviteFriendOperationData(); arg.User = inviter; arg.Operation = InviteFriendOperation.Reject; Service.InviteFriendOperation(data.Token, arg); }); count = Session.QueryOver <FriendInvitation>().RowCount(); Assert.AreEqual(0, count); GetProfileInformationCriteria criteria = new GetProfileInformationCriteria(); ProfileInformationDTO info = null; RunServiceMethod(delegate(InternalBodyArchitectService Service) { info = Service.GetProfileInformation(data.Token, criteria); }); Assert.AreEqual(0, info.Messages.Count); data = SecurityManager.CreateNewSession(inviter, ClientInformation); RunServiceMethod(delegate(InternalBodyArchitectService Service) { info = Service.GetProfileInformation(data.Token, criteria); }); Assert.AreEqual(2, info.Messages.Count); }
public void TestFriends_Myselft() { var profile0 = (ProfileDTO)profiles[0].Tag; SessionData data = CreateNewSession(profile0, ClientInformation); GetProfileInformationCriteria criteria = new GetProfileInformationCriteria(); RunServiceMethod(delegate(InternalBodyArchitectService Service) { var profileInfo = Service.GetProfileInformation(data.Token, criteria); Assert.AreEqual(1, profileInfo.Friends.Count); }); }
public void TestBirthdayDate_Myselft() { var profile0 = (ProfileDTO)profiles[0].Tag; SessionData data = CreateNewSession(profile0, ClientInformation); GetProfileInformationCriteria criteria = new GetProfileInformationCriteria(); RunServiceMethod(delegate(InternalBodyArchitectService Service) { var profileInfo = Service.GetProfileInformation(data.Token, criteria); Assert.IsTrue(UnitTestHelper.CompareDateTime(profile0.Birthday, profileInfo.Birthday.Value)); }); }
public void IsOffline() { var profile0 = (ProfileDTO)profiles[1].Tag; SessionData data = CreateNewSession(profile0, ClientInformation); GetProfileInformationCriteria criteria = new GetProfileInformationCriteria(); criteria.UserId = profiles[0].GlobalId; RunServiceMethod(delegate(InternalBodyArchitectService Service) { var profileInfo = Service.GetProfileInformation(data.Token, criteria); Assert.IsFalse(profileInfo.User.IsOnline); }); }
public void TestWymiary_Myselft() { var profile0 = (ProfileDTO)profiles[0].Tag; SessionData data = CreateNewSession(profile0, ClientInformation); GetProfileInformationCriteria criteria = new GetProfileInformationCriteria(); RunServiceMethod(delegate(InternalBodyArchitectService Service) { var profileInfo = Service.GetProfileInformation(data.Token, criteria); Assert.IsNotNull(profileInfo.Wymiary); Assert.AreEqual(100, profileInfo.Wymiary.Height); }); }
public void TestFavoriteUsers_Myselft() { profiles[0].FavoriteUsers.Add(profiles[1]); insertToDatabase(profiles[0]); var profile0 = (ProfileDTO)profiles[0].Tag; SessionData data = SecurityManager.CreateNewSession(profile0, ClientInformation); GetProfileInformationCriteria criteria = new GetProfileInformationCriteria(); RunServiceMethod(delegate(InternalBodyArchitectService Service) { var profileInfo = Service.GetProfileInformation(data.Token, criteria); Assert.AreEqual(1, profileInfo.FavoriteUsers.Count); }); }
private void getProfileInformation() { var m = new ServiceManager <GetProfileInformationCompletedEventArgs>(delegate(BodyArchitectAccessServiceClient client1, EventHandler <GetProfileInformationCompletedEventArgs> operationCompleted) { GetProfileInformationCriteria criteria = new GetProfileInformationCriteria(); progressBar.ShowProgress(true, ApplicationStrings.CreateProfilePage_ProgressRetrieveProfile); client1.GetProfileInformationAsync(ApplicationState.Current.SessionData.Token, criteria); client1.GetProfileInformationCompleted -= operationCompleted; client1.GetProfileInformationCompleted += operationCompleted; }); m.OperationCompleted += (s, a1) => { if (cancel) { progressBar.ShowProgress(false); IsHitTestVisible = true; creating = false; return; } progressBar.ShowProgress(false); if (a1.Error != null) { IsHitTestVisible = true; creating = false; updateGui(); ApplicationState.Current.SessionData = null; BAMessageBox.ShowError(ApplicationStrings.CreateProfilePage_ErrRetrieveProfile); } else if (a1.Result != null) { ApplicationState.Current.ProfileInfo = a1.Result.Result; } if (NavigationService.CanGoBack) { NavigationService.GoBack(); } }; if (!m.Run()) { IsHitTestVisible = true; creating = false; updateGui(); progressBar.ShowProgress(false); } }
public void DataInfo_Myselft() { var value = Guid.NewGuid(); profiles[0].DataInfo.WorkoutPlanHash = value; insertToDatabase(profiles[0]); var profile0 = (ProfileDTO)profiles[0].Tag; SessionData data = CreateNewSession(profile0, ClientInformation); GetProfileInformationCriteria criteria = new GetProfileInformationCriteria(); RunServiceMethod(delegate(InternalBodyArchitectService Service) { var profileInfo = Service.GetProfileInformation(data.Token, criteria); Assert.IsNotNull(profileInfo.DataInfo); Assert.AreEqual(value, profileInfo.DataInfo.WorkoutPlanHash); }); }
public void TestLicence_Myselft() { profiles[0].Licence.BAPoints = 10; profiles[0].Licence.LastPointOperationDate = DateTime.UtcNow; insertToDatabase(profiles[0]); var profile0 = (ProfileDTO)profiles[0].Tag; SessionData data = CreateNewSession(profile0, ClientInformation); GetProfileInformationCriteria criteria = new GetProfileInformationCriteria(); RunServiceMethod(delegate(InternalBodyArchitectService Service) { var profileInfo = Service.GetProfileInformation(data.Token, criteria); Assert.AreEqual(AccountType.Instructor, profileInfo.Licence.CurrentAccountType); Assert.AreEqual(AccountType.Instructor, profileInfo.Licence.AccountType); Assert.AreEqual(10, profileInfo.Licence.BAPoints); }); }
public void TestLicence_Others() { profiles[0].Licence.BAPoints = 10; profiles[0].Licence.AccountType = Model.AccountType.PremiumUser; profiles[0].Licence.LastPointOperationDate = DateTime.UtcNow; insertToDatabase(profiles[0]); var profile0 = (ProfileDTO)profiles[1].Tag; SessionData data = CreateNewSession(profile0, ClientInformation); GetProfileInformationCriteria criteria = new GetProfileInformationCriteria(); criteria.UserId = profiles[0].GlobalId; RunServiceMethod(delegate(InternalBodyArchitectService Service) { var profileInfo = Service.GetProfileInformation(data.Token, criteria); Assert.IsNull(profileInfo.Licence); }); }
private void refreshProfileInfo() { progressBar.ShowProgress(true, ApplicationStrings.Login_ProgressRetrieveProfile); var profileInfoService = new ServiceManager <GetProfileInformationCompletedEventArgs>(delegate(BodyArchitectAccessServiceClient client1, EventHandler <GetProfileInformationCompletedEventArgs> operationCompleted) { var param = new GetProfileInformationCriteria(); param.UserId = ApplicationState.Current.SessionData.Profile.GlobalId; client1.GetProfileInformationAsync(ApplicationState.Current.SessionData.Token, param); client1.GetProfileInformationCompleted -= operationCompleted; client1.GetProfileInformationCompleted += operationCompleted; }); profileInfoService.OperationCompleted += (s1, a1) => { if (a1.Error != null) { updateButtons(true); progressBar.ShowProgress(false); BAMessageBox.ShowError(ApplicationStrings.MyProfileControl_CantRetrieveProfileInfo_ErrMsg); return; } ApplicationState.Current.ProfileInfo = a1.Result.Result; fillCurrentLicence(); ((App)App.Current).EnsureAdVisible(null); updateButtons(true); pivot.SelectedIndex = 0; progressBar.ShowProgress(false); }; if (!profileInfoService.Run()) { progressBar.ShowProgress(false); if (ApplicationState.Current.IsOffline) { BAMessageBox.ShowError(ApplicationStrings.ErrOfflineMode); } else { BAMessageBox.ShowError(ApplicationStrings.ErrNoNetwork); } } }
public void LoadDetails() { var m = new ServiceManager <GetProfileInformationCompletedEventArgs>(delegate(BodyArchitectAccessServiceClient client1, EventHandler <GetProfileInformationCompletedEventArgs> operationCompleted) { GetProfileInformationCriteria data = new GetProfileInformationCriteria(); data.UserId = user.GlobalId; client1.GetProfileInformationCompleted -= operationCompleted; client1.GetProfileInformationCompleted += operationCompleted; client1.GetProfileInformationAsync(ApplicationState.Current.SessionData.Token, data); }); m.OperationCompleted += (s, a) => { if (a.Error != null) { onOperationCompleted(); BAMessageBox.ShowError(ApplicationStrings.UserViewModel_ErrRetrieveProfileDetails); } else { user.ProfileInfo = a.Result.Result; NotifyPropertyChanged("About"); NotifyPropertyChanged("HasMeasurements"); NotifyPropertyChanged("Wymiary"); NotifyPropertyChanged("HasAbout"); onOperationCompleted(); } }; if (!m.Run()) { onOperationCompleted(); if (ApplicationState.Current.IsOffline) { BAMessageBox.ShowError(ApplicationStrings.ErrOfflineMode); } else { BAMessageBox.ShowError(ApplicationStrings.ErrNoNetwork); } } }
public void TestMessages_Other() { Message msg = new Message(); msg.MessageType = MessageType.InvitationAccepted; msg.Sender = profiles[1]; msg.Receiver = profiles[0]; insertToDatabase(msg); var profile0 = (ProfileDTO)profiles[2].Tag; SessionData data = SecurityManager.CreateNewSession(profile0, ClientInformation); GetProfileInformationCriteria criteria = new GetProfileInformationCriteria(); criteria.UserId = profiles[0].Id; RunServiceMethod(delegate(InternalBodyArchitectService Service) { var profileInfo = Service.GetProfileInformation(data.Token, criteria); Assert.AreEqual(0, profileInfo.Messages.Count); }); }
public void TestAddToFavorites() { ProfileDTO profile1 = (ProfileDTO)profiles[0].Tag; ProfileDTO profile2 = (ProfileDTO)profiles[1].Tag; SessionData data = SecurityManager.CreateNewSession(profile2, ClientInformation); RunServiceMethod(delegate(InternalBodyArchitectService Service) { Service.UserFavoritesOperation(data.Token, profile1, FavoriteOperation.Add); }); GetProfileInformationCriteria criteria = new GetProfileInformationCriteria(); RunServiceMethod(delegate(InternalBodyArchitectService Service) { var info = Service.GetProfileInformation(data.Token, criteria); Assert.AreEqual(1, info.FavoriteUsers.Count); Assert.AreEqual(profile1.Id, info.FavoriteUsers[0].Id); }); }
public void TestInvitations_Myselft() { FriendInvitation invitation = new FriendInvitation(); invitation.Inviter = profiles[0]; invitation.Invited = profiles[1]; invitation.InvitationType = FriendInvitationType.Invitation; invitation.CreateDate = DateTime.UtcNow; insertToDatabase(invitation); var profile0 = (ProfileDTO)profiles[0].Tag; SessionData data = SecurityManager.CreateNewSession(profile0, ClientInformation); GetProfileInformationCriteria criteria = new GetProfileInformationCriteria(); RunServiceMethod(delegate(InternalBodyArchitectService Service) { var profileInfo = Service.GetProfileInformation(data.Token, criteria); Assert.AreEqual(1, profileInfo.Invitations.Count); }); }
private void mnuRefresh_Click(object sender, EventArgs e) { progressBar.ShowProgress(true, ApplicationStrings.Login_ProgressRetrieveProfile); ((MyProfileViewModel)DataContext).RefreshMessages(); var m = new ServiceManager <GetProfileInformationCompletedEventArgs>(delegate(BodyArchitectAccessServiceClient client1, EventHandler <GetProfileInformationCompletedEventArgs> operationCompleted) { GetProfileInformationCriteria criteria = new GetProfileInformationCriteria(); client1.GetProfileInformationAsync(ApplicationState.Current.SessionData.Token, criteria); client1.GetProfileInformationCompleted -= operationCompleted; client1.GetProfileInformationCompleted += operationCompleted; }); m.OperationCompleted += (s, a) => { progressBar.ShowProgress(false); if (a.Result.Result != null) { ApplicationState.Current.ProfileInfo = a.Result.Result; DataContext = new MyProfileViewModel(ApplicationState.Current.ProfileInfo); } else { BAMessageBox.ShowError(ApplicationStrings.MyProfileControl_CantRetrieveProfileInfo_ErrMsg); } }; if (!m.Run()) { progressBar.ShowProgress(false); if (ApplicationState.Current.IsOffline) { BAMessageBox.ShowError(ApplicationStrings.ErrOfflineMode); } else { BAMessageBox.ShowError(ApplicationStrings.ErrNoNetwork); } } }
public void TestLicence_Myselft_PaymentsData() { profiles[0].Licence.BAPoints = 10; profiles[0].Licence.LastPointOperationDate = DateTime.UtcNow; insertToDatabase(profiles[0]); var profile0 = (ProfileDTO)profiles[0].Tag; SessionData data = CreateNewSession(profile0, ClientInformation); GetProfileInformationCriteria criteria = new GetProfileInformationCriteria(); RunServiceMethod(delegate(InternalBodyArchitectService service) { var manager = new PaymentsManager(); var accountTypes = new Dictionary <AccountType, PaymentAccountType>() { { AccountType.Instructor, new PaymentAccountType() { AccountType = AccountType.Instructor, Points = 3, PromotionPoints = 1, PromotionStartDate = DateTime.UtcNow } }, { AccountType.PremiumUser, new PaymentAccountType() { AccountType = AccountType.PremiumUser, Points = 1 } }, }; var itemsToBuy = new Dictionary <string, int>(); service.Configuration.Payments = manager.Load(accountTypes, itemsToBuy, 10); var profileInfo = service.GetProfileInformation(data.Token, criteria); Assert.AreEqual(10, profileInfo.Licence.Payments.Kara); Assert.AreEqual(3, profileInfo.Licence.Payments.AccountTypes[AccountType.Instructor].Points); Assert.AreEqual(1, profileInfo.Licence.Payments.AccountTypes[AccountType.Instructor].PromotionPoints); Assert.AreEqual(null, profileInfo.Licence.Payments.AccountTypes[AccountType.PremiumUser].PromotionPoints); Assert.AreEqual(1, profileInfo.Licence.Payments.AccountTypes[AccountType.PremiumUser].Points); }); }
public void Records_PrivacyPublic() { setCalendarPrivacy(Privacy.Public); var exercise = CreateExercise(Session, null, "ex1", "ex1"); exercise.UseInRecords = true; insertToDatabase(exercise); var exercise1 = CreateExercise(Session, null, "ex2", "ex2"); CreateExerciseRecord(exercise, profiles[0], new Tuple <int, decimal>(2, 50), DateTime.UtcNow.Date.AddDays(-3)); CreateExerciseRecord(exercise1, profiles[0], new Tuple <int, decimal>(12, 150), DateTime.UtcNow.Date.AddDays(-13)); ProfileInformationDTO profileInfo = null; var profile0 = (ProfileDTO)profiles[0].Tag; var profile1 = (ProfileDTO)profiles[1].Tag; var profile2 = (ProfileDTO)profiles[2].Tag; SessionData data = CreateNewSession(profile1, ClientInformation); GetProfileInformationCriteria criteria = new GetProfileInformationCriteria(); criteria.UserId = profile0.GlobalId; RunServiceMethod(delegate(InternalBodyArchitectService Service) { profileInfo = Service.GetProfileInformation(data.Token, criteria); }); Assert.AreEqual(1, profileInfo.Records.Count); data = CreateNewSession(profile2, ClientInformation); RunServiceMethod(delegate(InternalBodyArchitectService Service) { profileInfo = Service.GetProfileInformation(data.Token, criteria); }); Assert.AreEqual(1, profileInfo.Records.Count); }