Ejemplo n.º 1
0
        public void TestMoveShelfOk()
        {
            var aisleManagerMock = new Mock <IAisleManager>();
            var shelfManagerMock = new Mock <IShelfManager>();

            aisleManagerMock.Setup(m =>
                                   m.GetAisleByAisleNumber(It.IsAny <int>()))
            .Returns(new Aisle {
                AisleID = 2
            });

            shelfManagerMock.Setup(m =>
                                   m.GetShelfByShelfNumber(It.IsAny <int>(), It.IsAny <int>()))
            .Returns(new Shelf
            {
                ShelfID = 2,
                Aisle   = new Aisle()
            });

            var libraryAPI = new LibraryAPI(aisleManagerMock.Object, shelfManagerMock.Object);
            var result     = libraryAPI.MoveShelf(101, 1);

            Assert.AreEqual(ShelfStatusCodes.Ok, result);
            shelfManagerMock.Verify(m =>
                                    m.MoveShelf(2, 2), Times.Once());
        }
Ejemplo n.º 2
0
        public void TestMoveShelf()
        {
            var sectionManagerMock = new Mock <ISectionManager>();
            var shelfManagerMock   = new Mock <IShelfManager>();
            var bookManagerMock    = new Mock <IBookManager>();

            sectionManagerMock.Setup(m =>
                                     m.GetSectionBySectionNumber(It.IsAny <int>()))
            .Returns(new Section {
                SectionID = 1
            });

            shelfManagerMock.Setup(m =>
                                   m.GetShelfByShelfNumber(It.IsAny <int>()))
            .Returns(new Shelf
            {
                ShelfID = 1,
                Section = new Section()
            });

            var libraryAPI = new LibraryAPI(sectionManagerMock.Object, shelfManagerMock.Object, bookManagerMock.Object);
            var result     = libraryAPI.MoveShelf(2, 2);

            Assert.AreEqual(MoveShelfCodes.Ok, result);
            shelfManagerMock.Verify(m =>
                                    m.MoveShelf(1, 1), Times.Once());
        }
Ejemplo n.º 3
0
        public void MoveShelfNoSuchAisle()
        {
            var aisleManagerMock = SetupMock((Aisle)null);
            var shelfManagerMock = SetupMock(new Shelf {
                ShelfNumber = 101
            });

            var libraryApi = new LibraryAPI(aisleManagerMock.Object, shelfManagerMock.Object);
            var result     = libraryApi.MoveShelf(101, 9);

            Assert.AreEqual(ShelfStatusCodes.NoSuchAisle, result);
        }
Ejemplo n.º 4
0
        public void MoveShelfNoSuchShelf()
        {
            var aisleManagerMock = SetupMock(new Aisle {
                AisleNumber = 1
            });
            var shelfManagerMock = SetupMock((Shelf)null);

            var libraryApi = new LibraryAPI(aisleManagerMock.Object, shelfManagerMock.Object);
            var result     = libraryApi.MoveShelf(113, 1);

            Assert.AreEqual(ShelfStatusCodes.NoSuchShelf, result);
        }