< Summary

Class:MUNity.Models.Resolution.DeleteAmendment
Assembly:MUNity.Schema
File(s):C:\Users\aeuke\source\repos\PeerConradi\munity\src\MUNitySchema\Models\Resolution\DeleteAmendment.cs
Covered lines:0
Uncovered lines:13
Coverable lines:13
Total lines:46
Line coverage:0% (0 of 13)
Covered branches:0
Total branches:2
Branch coverage:0% (0 of 2)
Covered methods:0
Total methods:2
Method coverage:0% (0 of 2)

Metrics

MethodBranch coverage Cyclomatic complexity Line coverage
Apply(...)0%20%
Deny(...)100%10%

File(s)

C:\Users\aeuke\source\repos\PeerConradi\munity\src\MUNitySchema\Models\Resolution\DeleteAmendment.cs

#LineLine coverage
 1using System;
 2using System.Collections.Generic;
 3using System.Text;
 4using MUNity.Extensions.ResolutionExtensions;
 5using MUNity.Extensions.ObservableCollectionExtensions;
 6
 7namespace MUNity.Models.Resolution
 8{
 9
 10    /// <summary>
 11    /// The Delete Amendment is a type of amendment to remove an operative paragraph from the resolution.
 12    /// </summary>
 13    public class DeleteAmendment : AbstractAmendment
 14    {
 15        /// <summary>
 16        /// Removes the operative section with all children and amendments that are on it.
 17        /// </summary>
 18        /// <param name="parentSection"></param>
 19        /// <returns></returns>
 20        public override bool Apply(OperativeSection parentSection)
 021        {
 022            var paragraph = parentSection.FindOperativeParagraph(this.TargetSectionId);
 23
 024            if (!parentSection.Paragraphs.Contains(paragraph))
 025                return false;
 26
 027            parentSection.Paragraphs.Remove(paragraph);
 28
 029            parentSection.AmendmentsForOperativeParagraph(this.TargetSectionId).ForEach(n => parentSection.RemoveAmendme
 030            return true;
 031        }
 32
 33        /// <summary>
 34        /// Removes the delete amendment and all other delete amendments that are targeting the same operative paragraph
 35        /// </summary>
 36        /// <param name="section"></param>
 37        /// <returns></returns>
 38        public override bool Deny(OperativeSection section)
 039        {
 040            var count = section.DeleteAmendments.RemoveAll(n =>
 041                n.TargetSectionId == this.TargetSectionId);
 42
 043            return count > 0;
 044        }
 45    }
 46}

Methods/Properties

Apply(...)
Deny(...)