private void Test() { _auctionMock = new Mock<DbSet<Auction>>(); _lotMock = new Mock<DbSet<Lot>>(); _artPieceMock = new Mock<DbSet<ArtPiece>>(); _mockContext = new Mock<AuctionContext>(); _mockContext.Setup(m => m.Auctions).Returns(_auctionMock.Object); _mockContext.Setup(m => m.Lots).Returns(_lotMock.Object); _mockContext.Setup(m => m.ArtPieces).Returns(_artPieceMock.Object); _artPiece = new ArtPiece() { ArtPieceId = 1, Artist = "Anders", Description = "Hej", Name = "Mona Lisa", Number = 1001, PurchasePrice = 10 }; _lot = new Lot() { LotId = 1, MinBid = 20, Position = 1, ArtPiece = _artPiece }; _auction = new Auction { AuctionId = 1, AuctionName = "Test Auction", CreationDate = DateTime.Now, LotDuration = TimeSpan.FromMinutes(30), Multiplier = 3, Status = Status.Ready, Lots = new List<Lot>() { _lot } }; var data = new List<ArtPiece> { _artPiece }.AsQueryable(); _artPieceMock.As<IQueryable<ArtPiece>>().Setup(m => m.Provider).Returns(data.Provider); _artPieceMock.As<IQueryable<ArtPiece>>().Setup(m => m.Expression).Returns(data.Expression); _artPieceMock.As<IQueryable<ArtPiece>>().Setup(m => m.ElementType).Returns(data.ElementType); _artPieceMock.As<IQueryable<ArtPiece>>().Setup(m => m.GetEnumerator()).Returns(data.GetEnumerator()); }
private void Test() { _auctionMock = new Mock<DbSet<Auction>>(); _lotMock = new Mock<DbSet<Lot>>(); _artPieceMock = new Mock<DbSet<ArtPiece>>(); _mockContext = new Mock<AuctionContext>(); _mockContext.Setup(m => m.Auctions).Returns(_auctionMock.Object); _mockContext.Setup(m => m.Lots).Returns(_lotMock.Object); _mockContext.Setup(m => m.ArtPieces).Returns(_artPieceMock.Object); _artPiece = new ArtPiece() { ArtPieceId = 1, Artist = "Anders", Description = "Hej", Name = "Mona Lisa", Number = 1001, PurchasePrice = 10 }; _lot = new Lot() { LotId = 1, MinBid = 20, Position = 1, ArtPiece = _artPiece }; _auction = new Auction { AuctionId = 1, AuctionName = "Test Auction", CreationDate = DateTime.Now, LotDuration = TimeSpan.FromMinutes(30), Multiplier = 3, Status = Status.Ready, Lots = new List<Lot>() { _lot } }; _bidArtPiece = new ArtPiece() { ArtPieceId = 2, Artist = "Anders", Description = "Hej", Name = "Mona Lisa", Number = 1001, PurchasePrice = 10 }; Bid bid = new Bid() { Amount = 20, Bidder = new Member() { MemberId = 1}, BidId = 1 }; _bidLot = new Lot() { LotId = 2, MinBid = 20, Position = 1, ArtPiece = _bidArtPiece, Bids = new List<Bid>() { bid} }; _bidAuction = new Auction { AuctionId = 5, AuctionName = "Test Auction", CreationDate = DateTime.Now, LotDuration = TimeSpan.FromMinutes(30), Multiplier = 3, Status = Status.Ready, Lots = new List<Lot>() { _bidLot } }; _auctionMock.AddQueryData(new List<Auction> { _auction, _bidAuction }.AsQueryable()); }
public List<Bid> GetAllBidsByLot(Lot lot) { return _bidDb.GetAllByLot(lot); }
public List<Model.Bid> GetAllByLot(Lot lot) { var list = _ac.Bids.Where(b => b.LotId == lot.LotId).ToList(); return list; }
public List<Bid> GetAllBidsByLot(Lot lot) { return _bidService.GetAllBidsByLot(lot); }
void IAuctionService.StartLot(int time, Lot lot) { //throw new System.NotImplementedException(); }
public void AddLot(Lot lot) { _lotService.AddLot(lot); }
public void UpdateLot(Lot lot) { _lotService.UpdateLot(lot); }
public void StartLot(int time, Lot lot) { //throw new NotImplementedException(); }
public void UpdateLot(Lot lot) { if(lot.Position <= 0 || lot.MinBid <= 0) throw new ArgumentException(); _lotDb.Update(lot); }
public void AddLot(Lot lot) { if(lot.Position <= 0 || lot.MinBid <= 0) throw new ArgumentException(); _lotDb.Add(lot); }