Example #1
0
        public void ShouldCreateNote()
        {
            //arrange
            var Categ = new CategoriesRepository(_connectionstring).Create(new Category()
            {
                Name = "TestCategory", Id = Guid.NewGuid()
            });
            var GuidCreator = new UsersRepository(_connectionstring).Create(new ApplicationUser()
            {
                UserName = "******", Password = string.Empty
            }).Id_;
            var GuidCategory = Categ.Id;

            UsersForTests.Add(GuidCreator);
            CategoriesForTests.Add(GuidCategory);
            var note = new Note()
            {
                Title    = "TestNote",
                Text     = "TestText",
                Creator  = GuidCreator,
                Category = GuidCategory,
                Id       = Guid.NewGuid()
            };
            var repository = new NotesRepository(_connectionstring);

            //act
            var CreatedNote = repository.Create(note);

            NotesForTests.Add(CreatedNote.Id);
            var NoteFromDB = repository.GetNote(CreatedNote.Id);

            //assert
            Assert.AreEqual(CreatedNote.Id, NoteFromDB.Id);
        }
Example #2
0
 public void Add(NoteRepositoryItem item)
 {
     _notesRepository.Create(item);
 }