public async Task Should_ContinueWhenEntityAlreadyDeleted_When_DeletingBurnRule()
        {
            _burnRuleRepositoryMock.Setup(b => b.GetAsync(It.IsAny <Guid>(), It.IsAny <bool>()))
            .ReturnsAsync(() => null);

            _fileServiceMock.Setup(c => c.DeleteAsync(It.IsAny <Guid>()))
            .Returns(Task.CompletedTask);

            _burnRuleRepositoryMock.Setup(br => br.DeleteAsync(It.IsAny <BurnRuleModel>()))
            .Returns(Task.CompletedTask);

            var service = new BurnRuleService(
                AssetName,
                _burnRuleRepositoryMock.Object,
                _burnRuleContentRepositoryMock.Object,
                _spendRuleChangeEventPublisher.Object,
                EmptyLogFactory.Instance,
                _fileServiceMock.Object,
                _burnRuleContentValidationMock.Object,
                _burnRulePartnerRepositoryMock.Object);

            var exception = await Record.ExceptionAsync(() => service.DeleteAsync(Guid.NewGuid()));

            Assert.Null(exception);

            _burnRuleRepositoryMock.
            Verify(r => r.GetAsync(It.IsAny <Guid>(), It.IsAny <bool>()), Times.Once);

            _fileServiceMock
            .Verify(c => c.DeleteAsync(It.IsAny <Guid>()), Times.Never);

            _burnRuleRepositoryMock
            .Verify(expression: br => br.DeleteAsync(It.IsAny <BurnRuleModel>()), Times.Never);
        }
        public async Task Should_RemoveOldContentsAndDeleteImagesIfTypeIsPictureUrl_When_DeletingBurnRule()
        {
            var fixture = new Fixture();

            var contentOld = fixture.Build <BurnRuleContentModel>()
                             .With(c => c.Id, Guid.Parse("26a88452-48ab-48eb-b9df-a22b281d1584"))
                             .With(c => c.RuleContentType, RuleContentType.UrlForPicture)
                             .Create();

            var contentOld1 = fixture.Build <BurnRuleContentModel>()
                              .With(c => c.Id, Guid.Parse("26a88452-48ab-48eb-b9df-a22b281d1584"))
                              .With(c => c.RuleContentType, RuleContentType.Description)
                              .Create();

            var burnModelOld = fixture.Build <BurnRuleModel>()
                               .With(c => c.BurnRuleContents,
                                     new List <BurnRuleContentModel>()
            {
                contentOld,
                contentOld1
            })
                               .Create();

            _burnRuleRepositoryMock.Setup(b => b.GetAsync(It.IsAny <Guid>(), It.IsAny <bool>()))
            .ReturnsAsync(burnModelOld);

            _fileServiceMock.Setup(c => c.DeleteAsync(It.IsAny <Guid>()))
            .Returns(Task.CompletedTask);

            _burnRuleRepositoryMock.Setup(br => br.DeleteAsync(It.IsAny <BurnRuleModel>()))
            .Returns(Task.CompletedTask);

            var service = new BurnRuleService(
                AssetName,
                _burnRuleRepositoryMock.Object,
                _burnRuleContentRepositoryMock.Object,
                _spendRuleChangeEventPublisher.Object,
                EmptyLogFactory.Instance,
                _fileServiceMock.Object,
                _burnRuleContentValidationMock.Object,
                _burnRulePartnerRepositoryMock.Object);

            var exception = await Record.ExceptionAsync(() => service.DeleteAsync(burnModelOld.Id));

            Assert.Null(exception);

            _burnRuleRepositoryMock.
            Verify(r => r.GetAsync(It.IsAny <Guid>(), It.IsAny <bool>()), Times.Once);

            _fileServiceMock
            .Verify(c => c.DeleteAsync(Guid.Parse("26a88452-48ab-48eb-b9df-a22b281d1584")), Times.Once);

            _burnRuleRepositoryMock
            .Verify(expression: br => br.DeleteAsync(burnModelOld), Times.Once);
        }