예제 #1
0
 protected void ThenACorresponsingRowInDatabaseShouldContainBiddingMethod(BiddingMethod biddingMethod)
 {
     using (var connection = new SqlConnection(ConfigurationManager.ConnectionStrings[this.ConnectionName].ConnectionString))
     {
         connection.Open();
         var sql = "SELECT * FROM [AuctionSettings] WHERE Id = @Id";
         Assert.Single(SqlMapper.Query<AuctionSettings>(connection, sql, new { Id = this.ReturnedAuctionIdentity.Id }), a => a.BiddingMethod == biddingMethod);
     }
 }
예제 #2
0
 internal AuctionSettings Construct(BiddingMethod biddingMethod, DateTime endDate)
 {
     var settings = new AuctionSettings()
     {
         AuctioneerId = this.ServiceContext.ParticipantId,
         ApplicationId = this.ServiceContext.ApplicationId,
         BiddingMethod = biddingMethod,
         EndDate = endDate
     };
     return settings;
 }
예제 #3
0
        public BiddingTimeRange(TimeSpan startTime, TimeSpan endTime, BiddingMethod method, bool acceptOrderCancellation)
        {
            if (startTime >= endTime)
            {
                throw new ArgumentException("start time must be smaller than end time");
            }

            StartTime = startTime;
            EndTime   = endTime;
            Method    = method;
            IsOrderCancellationAcceptable = acceptOrderCancellation;
        }
예제 #4
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="method">The method.</param>
 /// <returns></returns>
 public IBidManager Build(BiddingMethod method)
 {
     switch (method)
     {
         case BiddingMethod.Private:
             return new SealedBidManager(this.ServiceContext);
         case BiddingMethod.Public:
             throw new NotImplementedException();
         default:
             throw new NotImplementedException();
     }
 }
예제 #5
0
 protected void WhenAnAuctionIsCreatedWithSettings(BiddingMethod BiddingMethod, DateTime EndDate)
 {
     var service = new AuctionService();
     this.ReturnedAuctionIdentity = service.CreateAuction(BiddingMethod, EndDate);
 }
예제 #6
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="biddingMethod">The bidding method.</param>
 /// <param name="endDate">The end date.</param>
 /// <returns></returns>
 public AuctionIdentity Create(BiddingMethod biddingMethod, DateTime endDate)
 {
     var settings = new AuctionSettingsBuilder(this.ServiceContext).Construct(biddingMethod, endDate);
     var value = new AuctionSettingsRepository().Insert(settings);
     return new AuctionIdentity() { Id = value };
 }
예제 #7
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="settings">The settings.</param>
 /// <returns></returns>
 public IAuctionIdentity CreateAuction(BiddingMethod biddingMethod, DateTime endDate)
 {
     var manager = new AuctionSettingsManager(this.ServiceContext);
     return manager.Create(biddingMethod, endDate);
 }