예제 #1
0
        public void CanDeleteLabel()
        {
            var labelRepository  = new LocalRepository <Label>();
            var clientRepository = new LocalRepository <Client>();
            var controller       = new LabelController(labelRepository, clientRepository);

            labelRepository.Add(new Label()
            {
                Id = 1, Name = "Label 1"
            });
            labelRepository.Add(new Label()
            {
                Id = 2, Name = "Label 2"
            });
            labelRepository.Add(new Label()
            {
                Id = 3, Name = "Label 3"
            });

            Assert.AreEqual(3, labelRepository.All().Count());

            controller.Delete(2);

            Assert.AreEqual(2, labelRepository.All().Count());
            Assert.IsTrue(labelRepository.All().Any(l => l.Id == 1 && l.Name == "Label 1"));
            Assert.IsTrue(labelRepository.All().Any(l => l.Id == 3 && l.Name == "Label 3"));
        }
예제 #2
0
        public void Delete_Label()
        {
            //Act
            Labels lastLabel        = m_ScrumToolDBContext.Labels.Last();
            int    initalLabelCount = m_ScrumToolDBContext.Labels.Count();

            //Arrange
            m_LabelController.Delete(lastLabel.ID);
            //Assert
            m_ScrumToolDBContext.Labels.Should().HaveCount(initalLabelCount - 1, "Number of inital labels - 1")
            .And.NotContain(lastLabel);
        }
예제 #3
0
        public async Task Label_Delete_ShouldReturnData()
        {
            var results = await _controller.Delete(DefaultLabel);

            results.Should().BeOfType <OkResult>();
        }