private ShelfStatusCodes AddShelfNumberOne(Mock <IShelfManager> shelfManagerMock) { var aisleManagerMock = SetupMock(new Aisle { AisleNumber = 1 }); var libraryAPI = new LibraryAPI(aisleManagerMock.Object, shelfManagerMock.Object); var successfull = libraryAPI.AddShelf(101, 1); return(successfull); }
public void TestAddShelf() { var shelfManagerMock = new Mock <IShelfManager>(); var aisleManagerMock = new Mock <IAisleManager>(); shelfManagerMock.Setup(m => m.AddShelf(It.IsAny <int>())); shelfManagerMock.Setup(m => m.GetShelfByShelfNumber(It.IsAny <int>())); var libraryAPI = new LibraryAPI(aisleManagerMock.Object, shelfManagerMock.Object, null, null); var successfull = libraryAPI.AddShelf(1); Assert.IsTrue(successfull); shelfManagerMock.Verify(m => m.AddShelf(It.Is <int>(i => i == 1)), Times.Once()); }
public void TestAddExistingShelf() { var sectionManagerMock = new Mock <ISectionManager>(); var shelfManagerMock = new Mock <IShelfManager>(); var BookManagerMock = new Mock <IBookManager>(); shelfManagerMock.Setup(m => m.GetShelfByShelfNumber(It.IsAny <int>())) .Returns(new Shelf()); shelfManagerMock.Setup(m => m.AddShelf(It.IsAny <int>())); var libraryAPI = new LibraryAPI(sectionManagerMock.Object, shelfManagerMock.Object, BookManagerMock.Object); var successfull = libraryAPI.AddShelf(1); Assert.IsFalse(successfull); shelfManagerMock.Verify( m => m.AddShelf(It.Is <int>(i => i == 1)), Times.Never()); }