Esempio n. 1
0
        public void ShouldNot_UpdateFolder_WhenNullInput()
        {
            var res = _repo.Update(null, null);

            Assert.True(res.HasError);
            Assert.True(res.Error.Code == ErrorCode.BadGetFolder);

            var folder = TestFactory.Create <ModelFolder>();

            Assert.False(_repo
                         .Create(folder)
                         .HasError);

            res = _repo.Update(folder.Uid, null);

            Assert.True(res.HasError);
            Assert.True(res.Error.Code == ErrorCode.BadUpdateFolder);
        }
        public void UpdateUserTest()
        {
            var auxFolder = new Folder {
                Name = "Pepe", Id = 1
            };
            var folder = folderRepository.Get(1);

            folderRepository.Update(folder, auxFolder);
            var modifiedFolder = folderRepository.Get(1);

            mockContext.Verify(e => e.SaveChanges(), Times.Once());
            Assert.AreEqual("Pepe", modifiedFolder.Name);
        }
Esempio n. 3
0
        public void UpdateUpdatesFolder()
        {
            const long   FolderId    = 4;
            const string updatedName = "UpdatedName";
            var          repo        = new FolderRepository(_context);

            var Folder = repo.Find(FolderId);

            Folder.Name = updatedName;
            repo.Update(Folder);

            var updatedFolder = repo.Find(FolderId);

            Assert.Equal(Folder, updatedFolder);
        }