Exemplo n.º 1
0
        public void AddMultiplePatrons()
        {
            var id2 = service.Add(Name2);

            var patron1 = service.Retrieve(id1);

            AssertPatron(patron1, id1, Name1);

            var patron2 = service.Retrieve(id2);

            AssertPatron(patron2, id2, Name2);
        }
Exemplo n.º 2
0
        public void Initialize()
        {
            classificationService = new StubClassificationService();
            classificationService.AddBook(Classification1, "T1", "A1", "2001");
            classificationService.AddBook(Classification2, "T2", "A2", "2002");

            scanner = new ScanStation(Branch1Id, classificationService);

            holdingService = new HoldingService();
            holdingService.DeleteAllHoldings();

            patronService = new PatronService();
            PatronService.DeleteAllPatrons();

            patronId1 = patronService.Add("Joe");
            patronId2 = patronService.Add("Jane");

            var holding = scanner.AddNewMaterial(Isbn1);

            Assert.That(holding.Barcode, Is.EqualTo(barcode1));
        }
        public void Add_New_Patron()
        {
            var mockSet = new Mock <DbSet <Patron> >();
            var mockCtx = new Mock <LibraryDbContext>();

            mockCtx.Setup(c => c.Patrons).Returns(mockSet.Object);
            var sut = new PatronService(mockCtx.Object);

            sut.Add(new Patron());

            mockCtx.Verify(s => s.Add(It.IsAny <Patron>()), Times.Once());
            mockCtx.Verify(c => c.SaveChanges(), Times.Once());
        }
Exemplo n.º 4
0
 public void Initialize()
 {
     PatronService.DeleteAllPatrons();
     service = new PatronService();
     id1     = service.Add(Name1);
 }