public async Task GetWinningBid_ReturnsHighestBid_WhenAuctionIsClosed() { //arrange var expectedAmount = 300; var groupCode = 1; var auction = GetAuctions("UserName", groupCode).First(a => a.AuktionID == 2); var mocks = CreateMocksForGetHighestBid(auction); var auctions = new Auctions(mocks.MockRepo.Object, mocks.MockUserManager.Object); //act var result = await auctions.GetWinningBid(auction); // Assert Assert.Equal(expectedAmount, result.Summa); }
public async Task GetWinningBid_ThrowsInvalidOperationException_WhenAuctionIsOpen() { //arrange var expectedErrorMessage = "This auction is still open"; var groupCode = 1; var auction = GetAuctions("UserName", groupCode).First(a => a.AuktionID == 4); var mocks = CreateMocksForGetHighestBid(auction); var auctions = new Auctions(mocks.MockRepo.Object, mocks.MockUserManager.Object); //act var exception = await Assert.ThrowsAsync <InvalidOperationException>(async() => { await auctions.GetWinningBid(auction); }); // Assert Assert.Equal(expectedErrorMessage, exception.Message); }