コード例 #1
0
        public void CreateLabel_ShouldReturnNullIfUserIsNotFound()
        {
            // Arrange
            var dbContext  = SetupDatabase(nameof(CreateItem_ShouldReturnNullIfUserIsNotFound));
            var repository = new TodoItemRepository(dbContext);

            // Act
            var result = repository.CreateLabel(3, new CreateLabelDto());

            // Assert
            Assert.Null(result);
        }
コード例 #2
0
        public void CreateLabel_ShouldReturnNullIfItemIsNotFound()
        {
            // Arrange
            var dbContext  = SetupDatabase(nameof(CreateLabel_ShouldReturnNullIfItemIsNotFound));
            var repository = new TodoItemRepository(dbContext);
            var input      = new CreateLabelDto
            {
                ParentId = 20,
                Label    = "Cheese"
            };

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

            // Assert
            Assert.Null(result);
        }
コード例 #3
0
        public void CreateLabel_ShouldCreateLabel()
        {
            // Arrange
            var dbContext  = SetupDatabase(nameof(CreateLabel_ShouldCreateLabel));
            var repository = new TodoItemRepository(dbContext);
            var input      = new CreateLabelDto
            {
                ParentId = 1,
                Label    = "Test label"
            };

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

            // Assert
            Assert.NotNull(result);
            var item = dbContext.Labels.FirstOrDefault(t => t.Name == "Test label");

            Assert.NotNull(item);
        }