예제 #1
0
        public void ThenTheContentOfListIsTheSameWithFile()
        {
            MockSnippetRepository _repo = new MockSnippetRepository(Mother.GetSnippets());
            SnippetCollection     actualSnippetCollection = new SnippetCollection(_repo);

            SnippetCollection expectedSnippetCollection = new SnippetCollection();

            expectedSnippetCollection.AddRange(Mother.GetSnippets());

            Assert.AreEqual(actualSnippetCollection.ToString(), expectedSnippetCollection.ToString());
        }
예제 #2
0
        public void ThenTheContentIsPersistentInFile()
        {
            ISnippetRepository _repo             = new SnippetRepositoryFactory().GetRepository(CodeStash3.DAL.Properties.Settings.Default.vc);
            SnippetCollection  snippetCollection = new SnippetCollection();

            Snippet testSnippet = new Snippet()
            {
                Code = "test code", Title = "Test Snippet", Language = "Test Language"
            };

            snippetCollection.Add(testSnippet);
            _repo.UpdateAllSnippets(snippetCollection);

            SnippetCollection actualSnippetCollection = new SnippetCollection();

            actualSnippetCollection.AddRange(_repo.GetAllSnippets());
            SnippetCollection expectedSnippetCollection = new SnippetCollection()
            {
                testSnippet
            };

            Assert.AreEqual(actualSnippetCollection.ToString(), expectedSnippetCollection.ToString());
            Assert.IsTrue(actualSnippetCollection.Count == 1);
        }