< Summary

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

Metrics

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

File(s)

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

#LineLine coverage
 1using System;
 2using System.Collections.Generic;
 3using System.Text;
 4using MUNity.Extensions.ResolutionExtensions;
 5
 6namespace MUNity.Models.Resolution
 7{
 8    /// <summary>
 9    /// An Amendment to move an operative paragraph to a new position.
 10    /// </summary>
 11    public class MoveAmendment : AbstractAmendment
 12    {
 13        /// <summary>
 14        /// The Id of the virtual paragraph that represents the new position of the operative paragraph.
 15        /// </summary>
 016        public string NewTargetSectionId { get; set; }
 17
 18        /// <summary>
 19        /// Will delete the opld amendment and move all its settings to the currently virtual paragraph.
 20        /// </summary>
 21        /// <param name="parentSection"></param>
 22        /// <returns></returns>
 23        public override bool Apply(OperativeSection parentSection)
 024        {
 025            var placeholder = parentSection.FindOperativeParagraph(NewTargetSectionId);
 026            var target = parentSection.FindOperativeParagraph(TargetSectionId);
 27
 028            if (target == null || placeholder == null)
 029                return false;
 30
 031            placeholder.Children = target.Children;
 032            placeholder.Corrected = target.Corrected;
 033            placeholder.IsLocked = false;
 034            placeholder.IsVirtual = false;
 035            placeholder.Name = target.Name;
 036            placeholder.OperativeParagraphId = target.OperativeParagraphId;
 037            target.OperativeParagraphId = Guid.NewGuid().ToString();
 038            this.TargetSectionId = target.OperativeParagraphId;
 039            placeholder.Text = target.Text;
 040            placeholder.Visible = true;
 041            parentSection.RemoveOperativeParagraph(target);
 042            return true;
 043        }
 44
 45        /// <summary>
 46        /// Will remove the amendment and the virtual paragraph.
 47        /// </summary>
 48        /// <param name="parentSection"></param>
 49        /// <returns></returns>
 50        public override bool Deny(OperativeSection parentSection)
 051        {
 052            parentSection.RemoveAmendment(this);
 053            return true;
 054        }
 55    }
 56}