public void GetUserForSnipeTest()
 {
     ServiceOthers target = new ServiceOthers(); // TODO: Initialize to an appropriate value
     Snipe snipe = null; // TODO: Initialize to an appropriate value
     User expected = null; // TODO: Initialize to an appropriate value
     User actual;
     actual = target.GetUserForSnipe(snipe);
     Assert.AreEqual(expected, actual);
     Assert.Inconclusive("Verify the correctness of this test method.");
 }
        /// <summary>
        /// This code should be executed just before the item ends
        /// </summary>
        /// <param name="snipe">Snipe to be executed</param>
        /// <returns></returns>
        public void PlaceBids()
        {
            try
            {

                SqlDataContext myDataConnection = new SqlDataContext();

                UltimateSniper_Services.ServiceOthers otherServ = new UltimateSniper_Services.ServiceOthers();

                User user = otherServ.GetUserForSnipe(_Snipe);

                if (user == null)
                {
                    _Snipe.SnipeErrorReason = "The user assocated to the snipe couldn't be loaded properly.";
                }
                else
                {
                    if (!_Snipe.SnipeInProgress)
                    {
                        _Snipe.SnipeInProgress = true;

                        myDataConnection.Save<Snipe>((object)_Snipe, _Snipe);
                    }

                    try
                    {
                        SL_Scheduler.eBayService.User = user;

                        while (true)
                        {
                            if (SL_Scheduler.eBayService.IsUserWinning(this._Snipe)) break;
                            SL_Scheduler.eBayService.SetSnipe(this._Snipe);
                            System.Threading.Thread.Sleep(1000);
                        }
                    }
                    catch (ControlObjectException ex)
                    {
                        foreach (UserMessage message in ex.ErrorList)
                        {
                            if (message.MessageCode == EnumMessageCode.SnipeBidOptimizerMaxBidReached)
                            {
                                UltimateSniper_Services.ServiceEmail emailService = new UltimateSniper_Services.ServiceEmail();

                                _Snipe.SnipeStatus = EnumSnipeStatus.OVERBID;
                                _Snipe.SnipeErrorReason = "The snipe bid is lower the current price.";

                                ServiceEmail.SendEmail(user, "[SnipeAgent] Maximum bid reached for: " + _Snipe.SnipeName, "Hello, the maximum bid for your item has been reached. You can still modify it and win the item. To do so, go on www.snipeagent.com and into the section 'My Snipes'. Kind regards, Snipe Agent.");
                            }
                        }
                        _Snipe.SnipeErrorReason = ex.Message;
                    }
                    catch (Exception ex)
                    {
                        _Snipe.SnipeErrorReason = ex.Message;
                    }
                }

                _Snipe.ItemLastUdpate = ServiceTimeZone.DateTimeToUniversal(DateTime.Now);
                _Snipe.SnipeInProgress = false;

                myDataConnection.Save<Snipe>((object)_Snipe, _Snipe);

            }
            catch (ControlObjectException ex)
            {
                foreach (UserMessage error in ex.ErrorList)
                    Logger.CreateLog("Error__Timer_BidOptimizer_RefreshSnipes_" + error.MessageCode.ToString() + error.Severity.ToString(), null, ex, EnumLogLevel.ERROR);
            }
            catch (Exception ex)
            {
                Logger.CreateLog("Error__Timer_BidOptimizer_RefreshSnipes", null, ex, EnumLogLevel.ERROR);
            }
        }