public override object[] GetCountArgs(string ticket) { WebAccountService.AccountPicturesQueryOptions qopt = new WebAccountService.AccountPicturesQueryOptions(); qopt.Hidden = true; object[] args = { ticket, GetTestAccountId(), qopt }; return(args); }
public void MoveAccountPictureTest() { // create a new user UserInfo user = CreateUserWithVerifiedEmailAddress(); // create pictures, there's a default one, so start at 1 const int count = 7; for (int i = 1; i < count; i++) { WebAccountService.TransitAccountPicture t_instance = new WebAccountService.TransitAccountPicture(); t_instance.Bitmap = GetNewBitmap(); t_instance.Description = GetNewString(); t_instance.Name = GetNewString(); t_instance.Id = EndPoint.CreateOrUpdateAccountPicture(user.ticket, t_instance); Console.WriteLine("Picture: {0}", t_instance.Id); } // check that the pictures are numbered 1 through count WebAccountService.AccountPicturesQueryOptions qopt = new WebAccountService.AccountPicturesQueryOptions(); qopt.Hidden = true; WebAccountService.TransitAccountPicture[] t_instances = EndPoint.GetAccountPictures( user.ticket, user.id, qopt, null); Assert.AreEqual(count, t_instances.Length); for (int i = 0; i < count; i++) { Assert.AreEqual(i + 1, t_instances[i].Position); } int[] seq_nomove = { 1, 2, 3, 4, 5, 6, 7 }; MoveAction[] actions = { new MoveAction(t_instances, 1, 0, seq_nomove), new MoveAction(t_instances, 5, 0, seq_nomove), new MoveAction(t_instances, 7, 0, seq_nomove), new MoveAction(t_instances, 1, -1, seq_nomove), new MoveAction(t_instances, 1, -100, seq_nomove), new MoveAction(t_instances, 7, 1, seq_nomove), new MoveAction(t_instances, 7, 100, seq_nomove), new MoveAction(t_instances, 1, 1, new int[] { 2,1, 3, 4, 5, 6, 7 }), new MoveAction(t_instances, 1, 1, new int[] { 2,3, 1, 4, 5, 6, 7 }), new MoveAction(t_instances, 1, 2, new int[] { 2,3, 4, 5, 1, 6, 7 }), new MoveAction(t_instances, 2, 1, new int[] { 3,2, 4, 5, 1, 6, 7 }), new MoveAction(t_instances, 2, -1, new int[] { 2,3, 4, 5, 1, 6, 7 }), new MoveAction(t_instances, 3, -2, new int[] { 3,2, 4, 5, 1, 6, 7 }), new MoveAction(t_instances, 3, 6, new int[] { 2,4, 5, 1, 6, 7, 3 }), }; foreach (MoveAction action in actions) { Console.WriteLine("Moving {0} by {1}", t_instances[action._index - 1].Id, action._disp); EndPoint.MoveAccountPicture(user.ticket, t_instances[action._index - 1].Id, action._disp); Assert.IsTrue(action.Compare(EndPoint.GetAccountPictures(user.ticket, user.id, qopt, null))); } DeleteUser(user.id); }