コード例 #1
0
        public void AddToDirectory_ShouldGetCorrectBoolean()
        {
            //Arrange
            GreenContent content    = new GreenContent();
            GreenRepo    repository = new GreenRepo();

            //Act
            bool addResult = repository.AddContentToDirectory(content);

            //Assert
            Assert.IsTrue(addResult);
        }
コード例 #2
0
        public void GetByTitle_ShouldReturnCorrectContent()
        {
            //Arrange
            GreenRepo    repo       = new GreenRepo();
            GreenContent newContent = new GreenContent();

            repo.AddContentToDirectory(newContent);
            string title = "";

            //Act
            GreenContent searchResult = repo.GetContentByTitle(title);

            //Assert
            Assert.AreEqual(searchResult.CarName, title);
        }
コード例 #3
0
        public void DeleteExistingContent_ShouldReturnTrue()
        {
            //Arrange
            GreenRepo    repo    = new GreenRepo();
            GreenContent content = new GreenContent();

            repo.AddContentToDirectory(content);

            //Act
            GreenContent oldContent = repo.GetContentByTitle();

            bool removeResult = repo.DeleteExistingContent(oldContent);

            //Assert
            Assert.IsNull(removeResult);
        }
コード例 #4
0
        public void UpdateExistingContent_ShouldReturnTrue()
        {
            //Arrange
            GreenRepo    repo       = new GreenRepo();
            GreenContent oldContent = new GreenContent();

            repo.AddContentToDirectory(oldContent);

            GreenContent newContent = new GreenContent();

            //Act
            bool updateResult = repo.UpdateExistingContent(oldContent.CarName, newContent);

            //Assert
            Assert.IsTrue(updateResult);
        }
コード例 #5
0
        public void GetDirectory_ShouldReturnCorrectCollection()
        {
            //Arrange
            GreenContent content = new GreenContent();
            GreenRepo    repo    = new GreenRepo();

            repo.AddContentToDirectory(content);

            //Act
            List <GreenContent> contents = repo.GetContents();

            bool directoryHasContent = contents.Contains(content);

            //Assert
            Assert.IsTrue(directoryHasContent);
        }