예제 #1
0
        public void DeleteLabel_ShouldReturnFalseIfItemIsNotFound()
        {
            // Arrange
            var dbContext  = SetupDatabase(nameof(DeleteLabel_ShouldReturnFalseIfItemIsNotFound));
            var repository = new TodoItemRepository(dbContext);
            var input      = new DeleteLabelDto
            {
                ParentId = 30
            };

            // Act
            var result = repository.DeleteLabel(3, input);

            // Assert
            Assert.False(result);
        }
예제 #2
0
        public void DeleteLabel_ShouldDeleteLabel()
        {
            // Arrange
            var dbContext  = SetupDatabase(nameof(DeleteLabel_ShouldDeleteLabel));
            var repository = new TodoItemRepository(dbContext);
            var input      = new DeleteLabelDto
            {
                ParentId = 1,
                Label    = "Today"
            };

            // Act
            var result = repository.DeleteLabel(1, input);

            // Assert
            Assert.True(result);
            var item = dbContext.Labels.FirstOrDefault(t => t.Id == 1);

            Assert.Null(item);
        }