Exemple #1
0
        public void Delete_Removes_Field()
        {
            var fieldId      = 1;
            var deletedField = new Field(fieldId, "First field");
            var fieldList    = new List <Field>()
            {
                deletedField,
                new Field(2, "Second field")
            };

            fieldRepo.GetById(fieldId).Returns(deletedField);
            fieldRepo.When(d => d.Delete(deletedField))
            .Do(d => fieldList.Remove(deletedField));

            fieldRepo.GetAll().Returns(fieldList);
            var result = underTest.Delete(fieldId);

            Assert.DoesNotContain(deletedField, result);
        }