Example #1
0
 public ScanStation(LibraryContext _context, int branchId, IClassificationService classificationService,
                    HoldingsService holdingsService, PatronsService patronsService)
 {
     this.classificationService = classificationService;
     this.holdingsService       = holdingsService;
     this.patronsService        = patronsService;
     BranchId = branchId;
     brId     = BranchId;
 }
        public ScanStation_WhenNewMaterialCheckedOutTest(DbContextFixture fixture)
        {
            fixture.Seed();
            context         = new LibraryContext(fixture.ContextOptions);
            holdingsService = new HoldingsService(context);
            patronsService  = new PatronsService(context);

            classificationServiceMock = new Mock <IClassificationService>();
            classificationService     = classificationServiceMock.Object;

            scanner = new ScanStation(context, 1, classificationService, holdingsService, patronsService);

            savedPatronId = patronsService.Create(new Patron {
                Name = ""
            });

            CheckOutNewMaterial();
        }
        public ScanStation_WhenNothingCheckedOutTest(DbContextFixture fixture)
        {
            fixture.Seed();
            context         = new LibraryContext(fixture.ContextOptions);
            patronsService  = new PatronsService(context);
            holdingsService = new HoldingsService(context);

            classificationServiceMock = new Mock <IClassificationService>();
            classificationService     = classificationServiceMock.Object;
            AlwaysReturnBookMaterial(classificationServiceMock);

            somePatronId = patronsService.Create(new Patron {
                Name = "x"
            });

            scanner = new ScanStation(context, 1, classificationService, new HoldingsService(context),
                                      new PatronsService(context));
        }
        public ScanStation_WhenMaterialCheckedInTest(DbContextFixture fixture)
        {
            fixture.Seed();
            context         = new LibraryContext(fixture.ContextOptions);
            patronsService  = new PatronsService(context);
            holdingsService = new HoldingsService(context);

            classificationServiceMock = new Mock <IClassificationService>();
            classificationService     = classificationServiceMock.Object;

            somePatronId = patronsService.Create(new Patron {
                Name = "x"
            });

            scanner = new ScanStation(context, 1, classificationService, holdingsService, patronsService);

            scanner.ScanNewMaterial(SomeBarcode, classificationServiceMock);
            scanner.CheckOut(SomeBarcode, somePatronId, now);
            scanner.CompleteCheckout();
            scanner.CheckIn(SomeBarcode, now);
        }
 public PatronsController(LibraryContext context)
 {
     this.context   = context;
     patronsService = new PatronsService(context);
 }
 public PatronsServiceTest(DbContextFixture fixture)
 {
     fixture.Seed();
     context = new LibraryContext(fixture.ContextOptions);
     service = new PatronsService(context);
 }