public void InsertSnippetFile_WhenSnippetFileToInsert_ShouldInsertOnce()
        {
            IDataGateway gateway    = Substitute.For <IDataGateway>();
            var          repository = new SnippetFileRepository(gateway);

            repository.InsertSnippetFile(new SnippetFile());
            gateway.Received(1).InsertSnippetFile(Arg.Any <SnippetFile>());
        }
        public void DeleteSnippetFile_WhenSnippetFileExists_ShouldDeleteSnippetFile()
        {
            IDataGateway gateway = Substitute.For <IDataGateway>();

            var repository = new SnippetFileRepository(gateway);

            repository.DeleteSnippetFile(1);
            gateway.Received().RemoveSnippetFile(Arg.Any <int>());
        }
        public void UpdateSnippetFile_WhenSnippetFilesAreNotAvailable_ReturnsFalse()
        {
            IDataGateway gateway = Substitute.For <IDataGateway>();

            gateway.UpdateSnippetFile(Arg.Any <SnippetFile>()).Returns(false);
            var repository = new SnippetFileRepository(gateway);

            Assert.IsFalse(repository.UpdateSnippetFile(new SnippetFile()));
        }
        public void GetSnippetFiles_WhenNoSnippetFiles_ReturnsEmptyCollection()
        {
            IDataGateway gateway = Substitute.For <IDataGateway>();

            var repository   = new SnippetFileRepository(gateway);
            var snippetFiles = repository.GetSnippetFiles();

            Assert.AreEqual(new List <SnippetFile>(), snippetFiles);
        }
        public void GetSnippetFiles_WhenSnippetFilesAreAvailable_ReturnsSnippetFiles()
        {
            IDataGateway gateway = Substitute.For <IDataGateway>();

            gateway.GetAllSnippetFiles().Returns(new List <SnippetFile>
            {
                new SnippetFile()
            });

            var repository   = new SnippetFileRepository(gateway);
            var snippetFiles = repository.GetSnippetFiles();

            Assert.AreEqual(1, snippetFiles.Count());
        }