public void controller_initialized_with_null_collection_base_fails()
        {
            ICollectionBase nullBase = null;

            _mockController = new HomeCollectionController(nullBase, _mockFileIO.Object);

            Assert.IsFalse(true, "Expected the test to fail when initialized with a null object");
        }
        public void controller_initialized_with_null_fileio_fails()
        {
            ICollectionBase collectionBase = _mockHomeCollection.Object;
            IFileIO         nullFileIO     = null;

            _mockController = new HomeCollectionController(collectionBase, nullFileIO);

            Assert.IsFalse(true, "Expected the test to fail when initialized with a null object");
        }
        public void calling_controller_loadcollection_calls_repository_loadcollection()
        {
            Mock <IHomeCollectionRepository> mockRepo       = new Mock <IHomeCollectionRepository>();
            HomeCollectionController         mockController = new HomeCollectionController(_mockHomeCollection.Object, _mockFileIO.Object, mockRepo.Object);
            string fullFilePath = "fullfilepath";

            mockController.LoadCollection(fullFilePath);

            mockRepo.Verify(r => r.LoadCollection(It.IsAny <string>()), Times.Once);
        }
        public void calling_controller_savecollection_with_overwrite_calls_repository_savecollection()
        {
            Mock <IHomeCollectionRepository> mockRepo       = new Mock <IHomeCollectionRepository>();
            HomeCollectionController         mockController = new HomeCollectionController(_mockHomeCollection.Object, _mockFileIO.Object, mockRepo.Object);
            string fullFilePath  = "fullfilepath";
            bool   overWriteFile = true;

            mockController.SaveCollection(fullFilePath, overWriteFile);

            mockRepo.Verify(r => r.SaveCollection(It.IsAny <string>(), true), Times.Once);
        }
        public void controller_collectiontype_returns_collectable_base_type()
        {
            Type            objType         = typeof(ICollectionBase);
            ICollectionBase collectableBase = _mockHomeCollection.Object;

            _mockHomeCollection.Setup(b => b.CollectionType).Returns(objType);

            _mockController = new HomeCollectionController(collectableBase, _mockFileIO.Object);
            Type objTestType = _mockController.CollectionType;

            Assert.AreEqual(objType, objTestType);
        }
        public void controller_initialized_with_collection_base_object_returns_controller_instance()
        {
            try
            {
                ICollectionBase collectionBase = _mockHomeCollection.Object;

                _mockController = new HomeCollectionController(collectionBase, _mockFileIO.Object);

                Assert.IsNotNull(_mockController);
            }
            catch
            {
                Assert.IsFalse(true, "Test should not fail when initialized with an object");
            }
        }
 public void InitializeTest()
 {
     // setup the controller using a mock instance of a collection base object
     _mockHomeCollection = new Mock <ICollectionBase>();
     _mockController     = new HomeCollectionController(_mockHomeCollection.Object, _mockFileIO.Object);
 }