public void MoveShelfOk() { var bookShelfAisleManagerMock = new Mock <IBookshelfAisleManager>(); var shelfManagerMock = new Mock <IShelfManager>(); bookShelfAisleManagerMock.Setup(m => m.GetBookshelfAisleByBookshelfAisleNumber(It.IsAny <int>())) .Returns(new BookShelfAisle { BookshelfAisleID = 2 }); shelfManagerMock.Setup(m => m.GetShelfByShelfNumber(It.IsAny <int>())) .Returns(new Shelf { ShelfID = 2, BookshelfAisle = new BookShelfAisle() }); var aisleAndShelfAPI = new AisleAndShelfAPI( bookShelfAisleManagerMock.Object, shelfManagerMock.Object, null); var result = aisleAndShelfAPI.MoveShelf(1, 1); Assert.AreEqual(MoveShelfError.Ok, result); shelfManagerMock.Verify(m => m.MoveShelf(2, 2), Times.Once()); }
private static bool AddBookShelfAisleNumberOne(Mock <IBookshelfAisleManager> bookShelfAisleManagerMock) { var AisleAndShelfAPI = new AisleAndShelfAPI( bookShelfAisleManagerMock.Object, null, null); var successfull = AisleAndShelfAPI.AddBookShelfAisle(1); return(successfull); }
public void RemoveNonexistingBookShelfAisle() { var bookShelfAisleManagerMock = new Mock <IBookshelfAisleManager>(); var shelfManagerMock = new Mock <IShelfManager>(); bookShelfAisleManagerMock.Setup(m => m.GetBookshelfAisleByBookshelfAisleNumber(It.IsAny <int>())) .Returns((BookShelfAisle)null); var aisleAndShelfAPI = new AisleAndShelfAPI(bookShelfAisleManagerMock.Object, shelfManagerMock.Object, null); var successfull = aisleAndShelfAPI.RemoveBookShelfAisle(3); Assert.AreEqual(RemoveBookShelfAisleError.NoSuchBookShelfAisle, successfull); bookShelfAisleManagerMock.Verify(m => m.RemoveBookshelfAisle(It.IsAny <int>()), Times.Never); }
public void RemoveEmptyBookShelfAisle() { var bookShelfAisleManagerMock = new Mock <IBookshelfAisleManager>(); var BookShelfAisleManagerMock = new Mock <IBookshelfAisleManager>(); var shelfManagerMock = new Mock <IShelfManager>(); bookShelfAisleManagerMock.Setup(m => m.GetBookshelfAisleByBookshelfAisleNumber(It.IsAny <int>())) .Returns(new BookShelfAisle { BookshelfAisleNumber = 3, Shelf = new List <Shelf>() }); var asileAndShelfAPI = new AisleAndShelfAPI( bookShelfAisleManagerMock.Object, shelfManagerMock.Object, null); var successfull = asileAndShelfAPI.RemoveBookShelfAisle(3); Assert.AreEqual(RemoveBookShelfAisleError.Ok, successfull); bookShelfAisleManagerMock.Verify(m => m.RemoveBookshelfAisle(It.IsAny <int>()), Times.Once); }
public void RemoveBookShelfAisleWithOneShelf() { var bookShelfAisleManagerMock = new Mock <IBookshelfAisleManager>(); var shelfManagerMock = new Mock <IShelfManager>(); bookShelfAisleManagerMock.Setup(m => m.GetBookshelfAisleByBookshelfAisleNumber(It.IsAny <int>())) .Returns(new BookShelfAisle { BookshelfAisleNumber = 4, Shelf = new List <Shelf> { new Shelf() } }); var aisleAndShelfAPI = new AisleAndShelfAPI( bookShelfAisleManagerMock.Object, shelfManagerMock.Object, null); var successfull = aisleAndShelfAPI.RemoveBookShelfAisle(4); Assert.AreEqual(RemoveBookShelfAisleError.BookShelfAisleHasShelf, successfull); bookShelfAisleManagerMock.Verify(m => m.RemoveBookshelfAisle(It.IsAny <int>()), Times.Never); }