< Summary

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

Metrics

MethodBranch coverage Cyclomatic complexity Line coverage
get_Id()100%10%
.ctor()100%10%
get_Name()100%10%
set_Name(...)100%10%
get_TargetSectionId()100%10%
set_TargetSectionId(...)100%10%
get_Activated()100%10%
set_Activated(...)100%10%
get_SubmitterName()100%10%
set_SubmitterName(...)100%10%
get_SubmitTime()100%10%
set_SubmitTime(...)100%10%
get_Type()100%10%
Apply(...)100%10%
Deny(...)100%10%
NotifyPropertyChanged(...)0%20%

File(s)

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

#LineLine coverage
 1using System;
 2using System.Collections.Generic;
 3using System.ComponentModel;
 4using System.Runtime.CompilerServices;
 5using System.Text;
 6
 7namespace MUNity.Models.Resolution
 8{
 9
 10    /// <summary>
 11    /// The abstraction of an amendment. The amendment is able to change Operative Paragraphs or interact with them.
 12    /// </summary>
 13    public class AbstractAmendment : INotifyPropertyChanged
 14    {
 15        /// <summary>
 16        /// The Id of the Amendment.
 17        /// </summary>
 018        public string Id { get; set; }
 19
 020        private string _name = "";
 21        /// <summary>
 22        /// A Name title for the Amendment. This is mostly not used by now but could be.
 23        /// </summary>
 24        public string Name {
 025            get => _name;
 26            set
 027            {
 028                _name = value;
 029                NotifyPropertyChanged(nameof(Name));
 030            }
 31        }
 32
 33        private string _targetSectionId;
 34        /// <summary>
 35        /// The Operative Paragraph Id that this Amendment should interact with.
 36        /// Note that this is an error in naming and doesnt target the Operative Section of a resolution.
 37        /// </summary>
 38        public string TargetSectionId {
 039            get => _targetSectionId;
 40            set
 041            {
 042                _targetSectionId = value;
 043                NotifyPropertyChanged(nameof(TargetSectionId));
 044            }
 45        }
 46
 047        private bool _activated = false;
 48        /// <summary>
 49        /// Is the Amendment activated at the moment.
 50        /// This is used if the amendment should be marked in a different way on the views.
 51        /// </summary>
 52        public bool Activated {
 053            get => _activated;
 54            set
 055            {
 056                _activated = value;
 057                NotifyPropertyChanged(nameof(Activated));
 058            }
 59        }
 60
 061        private string _submitterName = "";
 62        /// <summary>
 63        /// The name of the person, country, delegation that started this amendment.
 64        /// </summary>
 65        public string SubmitterName {
 066            get => _submitterName;
 67            set
 068            {
 069                _submitterName = value;
 070                NotifyPropertyChanged(nameof(SubmitterName));
 071            }
 72        }
 73
 74        private DateTime _submitTime;
 75        /// <summary>
 76        /// The time this amendment was created.
 77        /// </summary>
 78        public DateTime SubmitTime {
 079            get => _submitTime;
 80            set
 081            {
 082                _submitTime = value;
 083                NotifyPropertyChanged(nameof(SubmitTime));
 084            }
 85        }
 86
 87        /// <summary>
 88        /// A string Type to identify the type of amendment.
 89        /// </summary>
 090        public string Type { get; set; }
 91
 92        /// <summary>
 93        /// The action that should be called when the amendment is accepted and it should interact with
 94        /// the resolution and its target operative Paragraph.
 95        /// This method will return a NotImplemntedException if you call the base so keep in mind
 96        /// to override it.
 97        /// </summary>
 98        /// <param name="section"></param>
 99        /// <returns></returns>
 100        public virtual bool Apply(OperativeSection section)
 0101        {
 0102            throw new NotImplementedException();
 103        }
 104
 105        /// <summary>
 106        /// What should happen if the Amendment is decliened. Remember to override this Method when
 107        /// extending from Abstract Amendment.
 108        /// </summary>
 109        /// <param name="section"></param>
 110        /// <returns></returns>
 111        public virtual bool Deny(OperativeSection section)
 0112        {
 0113            throw new NotImplementedException();
 114        }
 115
 116        /// <summary>
 117        /// Creates a new Instance of an amendment and generates a GUID for it.
 118        /// </summary>
 0119        public AbstractAmendment()
 0120        {
 0121            Id = Guid.NewGuid().ToString();
 0122        }
 123
 124        /// <summary>
 125        /// Event that is fired when a property has changed.
 126        /// </summary>
 127        public event PropertyChangedEventHandler PropertyChanged;
 128
 129        /// <summary>
 130        /// Internal Event to fire the Property Changed event.
 131        /// </summary>
 132        /// <param name="name"></param>
 133        protected void NotifyPropertyChanged([CallerMemberName] string name = null)
 0134        {
 0135            PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(name));
 0136        }
 137    }
 138}