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); } }
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; }
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; }
/// <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(); } }
protected void WhenAnAuctionIsCreatedWithSettings(BiddingMethod BiddingMethod, DateTime EndDate) { var service = new AuctionService(); this.ReturnedAuctionIdentity = service.CreateAuction(BiddingMethod, EndDate); }
/// <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 }; }
/// <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); }