예제 #1
0
        public void Add_Label_When_Dropped_On_Task()
        {
            //Act
            Labels testLabel        = new Labels(m_ParentTaskID, "Green");
            int    initalLabelCount = m_ScrumToolDBContext.Labels.Count();

            //Arrange
            m_LabelController.Add(testLabel);
            //Assert
            m_ScrumToolDBContext.Labels.Should().NotBeNullOrEmpty()
            .And.HaveCount(initalLabelCount + 1, "Inital Label Count + 1");
            m_ScrumToolDBContext.Labels.Last().ShouldBeEquivalentTo(testLabel,
                                                                    options => options.Excluding(l => l.ID), "The last label object in the table should be the testLabel");
        }
        public async Task AddTest()
        {
            IActionResult result = await controller.Add(new CreateLabelDto { Description = "test" }, Version);

            CreatedAtActionResult response = result as CreatedAtActionResult;

            Assert.AreEqual(StatusCodes.Status201Created, (int)response.StatusCode);
        }