示例#1
0
 public void DeleteTestStory(int id)
 {
     try
     {
         Story story = _repository.GetById(id);
         _repository.Delete(story);
     }
     catch (Exception ex)
     {
         _logger.LogError(ex.Message);
     }
 }
        public void DeleteStoryShouldRemoveIt()
        {
            // Arrange
            var dataList = this.GetMockDataList();
            var repository = new StoryRepository(dataList);
            var expectedCount = dataList.Count() - 1;
            var notExpected = dataList[0];

            // Act
            repository.Delete(notExpected);
            var actual = repository.GetList();

            // Assert
            Assert.IsNotNull(actual);
            Assert.AreEqual(expectedCount, actual.Count());
            foreach (var story in actual)
            {
                if (notExpected.ProjectName == story.ProjectName)
                {
                    Assert.AreNotEqual(notExpected.Name, story.Name);
                }
            }
        }