Esempio n. 1
0
        public void GetAllByAuctionTest()
        {
            try {
                Test();
                var lotCtr = new LotDb(_mockContext.Object);

                var list = lotCtr.GetAllByAuction(_auction);

                Assert.AreNotEqual(0, list.Count);
            }
            catch (Exception e) {
                Console.WriteLine(e);
                Assert.Fail();
            }
        }
Esempio n. 2
0
        public void AddTest()
        {
            try {
                Test();
                var lotCtr = new LotDb(_mockContext.Object);

                lotCtr.Add(_lot);

                _lotMock.Verify(m => m.Add(It.IsAny<Lot>()), Times.Once());
                _mockContext.Verify(m => m.SaveChanges(), Times.Once());
            }
            catch (Exception e) {
                Console.WriteLine(e);
                Assert.Fail();
            }
        }
Esempio n. 3
0
        public void DeleteTest()
        {
            try {
                Test();
                var lotCtr = new LotDb(_mockContext.Object);

                lotCtr.Delete(_lot.LotId);

                _lotMock.Verify(m => m.Remove(It.IsAny<Lot>()), Times.Once);
                _mockContext.Verify(m => m.SaveChanges(), Times.Once);

                Assert.IsTrue(true);
            }
            catch (Exception e) {
                e.DebugGetLine();
                Assert.Fail();
            }
        }
Esempio n. 4
0
        public void GetByIdTest()
        {
            bool test = false;
            try {
                Test();
                var lotCtr = new LotDb(_mockContext.Object);

                var lot = lotCtr.GetById(1);

                test = true;

                lotCtr.GetById(2);

            }
            catch (NullReferenceException) {
                if (!test) {
                    Assert.Fail();
                }
                else {
                    Assert.IsTrue(true);
                }
            }
            catch (Exception e) {
                e.DebugGetLine();
                Assert.Fail();
            }
        }
Esempio n. 5
0
        public void UpdateTest()
        {
            try {
                Test();
                var lotCtr = new LotDb(_mockContext.Object);

                _lot.MinBid = 50;

                lotCtr.Update(_lot);

                var list = lotCtr.GetAllByAuction(_auction);

                Assert.AreEqual(50, list[0].MinBid);
            }
            catch (Exception e) {
                Console.WriteLine(e);
                Assert.Fail();
            }
        }