public void TestFinishAuctionNullUser() { ProductService productService = new ProductService(); ProductAuctionService productAuctionService = new ProductAuctionService(); Product product = productService.GetProductById(1); Boolean result = false; try { productAuctionService.closeAuction(null, product); } catch(EntityDoesNotExistException exc) { Assert.AreEqual("User is null", exc.Message); } Assert.IsFalse(result); }
public void TestFinishAuctionNotTheSameUser() { UserService userService = new UserService(); ProductAuctionService productAuctionService = new ProductAuctionService(); ProductService productService = new ProductService(); User user = userService.GetUserById(2); Product product = productService.GetProductById(1); Boolean result = false; try { productAuctionService.closeAuction(user, product); } catch (AuctionException exc) { Assert.AreEqual("You are not allowed to close the auction - you are not the owner!", exc.Message); } Assert.IsFalse(result); }
public void TestFinishAuctionNullProduct() { UserService userService = new UserService(); ProductAuctionService productAuctionService = new ProductAuctionService(); User user = userService.GetUserById(1); Boolean result = false; try { productAuctionService.closeAuction(user, null); } catch (EntityDoesNotExistException exc) { Assert.AreEqual("Product is null", exc.Message); } Assert.IsFalse(result); }
public void TestFinishAuctionAlreadyFinished() { UserService userService = new UserService(); ProductAuctionService productAuctionService = new ProductAuctionService(); ProductService productService = new ProductService(); User user = userService.GetUserById(1); Product product = productService.GetProductById(1); Boolean result = false; try { result = productAuctionService.closeAuction(user, product); } catch (AuctionException exc) { Assert.AreEqual("Auction already closed", exc.Message); } Assert.IsFalse(result); }