Beispiel #1
0
        public void MoveShelfNoSuchAisle()
        {
            var aisleManagerMock = SetupMock((Aisle)null);
            var shelfManagerMock = new Mock <IShelfManager>();

            var storageAPI = new StorageAPI(aisleManagerMock.Object, shelfManagerMock.Object);
            var result     = storageAPI.MoveShelf(1, 1);

            Assert.AreEqual(MoveShelfStatusCodes.NoSuchAisle, result);
            shelfManagerMock.Verify(m =>
                                    m.MoveShelf(2, 2), Times.Never());
        }
Beispiel #2
0
        public void MoveShelfOk()
        {
            var aisleManagerMock = SetupMock(new Aisle {
                AisleID = 2
            });
            var shelfManagerMock = SetupMock(new Shelf
            {
                ShelfID = 2,
                Aisle   = new Aisle()
            });

            var storageAPI = new StorageAPI(aisleManagerMock.Object, shelfManagerMock.Object);
            var result     = storageAPI.MoveShelf(1, 1);

            Assert.AreEqual(MoveShelfStatusCodes.Ok, result);
            shelfManagerMock.Verify(m =>
                                    m.MoveShelf(2, 2), Times.Once());
        }
Beispiel #3
0
        public void MoveShelfAlreadyInThatAisle()
        {
            var currentAisle = new Aisle {
                AisleNumber = 2
            };
            var aisleManagerMock = SetupMock(currentAisle);
            var shelfManagerMock = SetupMock(new Shelf
            {
                ShelfID = 2,
                Aisle   = currentAisle
            });

            var storageAPI = new StorageAPI(aisleManagerMock.Object, shelfManagerMock.Object);
            var result     = storageAPI.MoveShelf(2, 2);

            Assert.AreEqual(MoveShelfStatusCodes.ShelfAlreadyInThatAisle, result);
            shelfManagerMock.Verify(m =>
                                    m.MoveShelf(2, 2), Times.Never());
        }