< Summary

Class:MUNity.ViewModels.ListOfSpeakers.SpeakerViewModel
Assembly:MUNity.Schema
File(s):C:\Users\aeuke\source\repos\PeerConradi\munity\src\MUNitySchema\Models\ListOfSpeakers\SpeakerViewModel.cs
Covered lines:0
Uncovered lines:52
Coverable lines:52
Total lines:134
Line coverage:0% (0 of 52)
Covered branches:0
Total branches:26
Branch coverage:0% (0 of 26)
Covered methods:0
Total methods:14
Method coverage:0% (0 of 14)

Metrics

MethodBranch coverage Cyclomatic complexity Line coverage
get_Id()100%10%
get_Name()100%10%
set_Name(...)0%20%
get_Iso()100%10%
set_Iso(...)0%20%
get_Mode()100%10%
set_Mode(...)0%20%
.ctor()100%10%
get_OrdnerIndex()100%10%
set_OrdnerIndex(...)0%20%
get_ListOfSpeakers()100%10%
NotifyPropertyChanged(...)0%20%
CompareTo(...)0%80%
CompareTo(...)0%80%

File(s)

C:\Users\aeuke\source\repos\PeerConradi\munity\src\MUNitySchema\Models\ListOfSpeakers\SpeakerViewModel.cs

#LineLine coverage
 1using MUNity.Base;
 2using MUNityBase.Interfances;
 3using System;
 4using System.Collections.Generic;
 5using System.ComponentModel;
 6using System.Runtime.CompilerServices;
 7using System.Text;
 8using System.Text.Json.Serialization;
 9
 10namespace MUNity.ViewModels.ListOfSpeakers
 11{
 12
 13    /// <summary>
 14    /// A Speaker is someone who can be added to the Speakers or Questions inside a List of Speakers.
 15    /// You can give any time of name, so you could set it to a person a Country or Delegation.
 16    /// </summary>
 17    public class SpeakerViewModel : INotifyPropertyChanged, IComparable<SpeakerViewModel>, ISpeaker
 18    {
 19
 20        /// <summary>
 21        /// The Id of the Speaker. This can and should change every time
 22        /// even if the same person is in one of the lists twice to be able to identify it exact.
 23        /// The Id has nothing to do with the Paricipant, Delegation, Country etc.
 24        /// </summary>
 025        public string Id { get; set; }
 26
 27        private string _name;
 28        /// <summary>
 29        /// The Name that will be displayed.
 30        /// </summary>
 31        public string Name
 32        {
 033            get => _name;
 34            set
 035            {
 036                if (value != _name)
 037                {
 038                    _name = value;
 039                    NotifyPropertyChanged();
 040                }
 041            }
 42        }
 43
 44        private string _iso;
 45        /// <summary>
 46        /// An Iso code because mostly Counties will be used in this list. You could use the
 47        /// Iso to identify an icon.
 48        /// </summary>
 49        public string Iso
 50        {
 051            get => _iso;
 52            set
 053            {
 054                if (value != _iso)
 055                {
 056                    _iso = value;
 057                    NotifyPropertyChanged();
 058                }
 059            }
 60        }
 61
 62        private SpeakerModes _mode;
 63        /// <summary>
 64        /// The Mode if the Speaker is on the List of Speakers or asking a question
 65        /// </summary>
 66        public SpeakerModes Mode
 67        {
 068            get => _mode;
 69            set
 070            {
 071                if (_mode != value)
 072                {
 073                    _mode = value;
 074                    NotifyPropertyChanged();
 075                }
 076            }
 77        }
 78
 079        private int _orderIndex = 0;
 80        /// <summary>
 81        /// The Index of the Speaker.
 82        /// </summary>
 83        public int OrdnerIndex
 84        {
 085            get => _orderIndex;
 86            set
 087            {
 088                if (_orderIndex != value)
 089                {
 090                    _orderIndex = value;
 091                    NotifyPropertyChanged();
 092                }
 093            }
 94        }
 95
 96        /// <summary>
 97        /// The Parent SpeakerlistId
 98        /// </summary>
 99        [JsonIgnore]
 0100        public ListOfSpeakersViewModel ListOfSpeakers { get; set; }
 101
 102        /// <summary>
 103        /// Gets called when a proeprty has been changed. This does not inclide the SpeakerlistId or the Id.
 104        /// </summary>
 105        public event PropertyChangedEventHandler PropertyChanged;
 106        private void NotifyPropertyChanged([CallerMemberName]string name = "")
 0107        {
 0108            PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(name));
 0109        }
 110
 111        /// <summary>
 112        /// Compares this Speaker to another Speaker by its values.
 113        /// </summary>
 114        /// <param name="other"></param>
 115        /// <returns></returns>
 116        public int CompareTo(SpeakerViewModel other)
 0117        {
 0118            if (this.Id != other.Id) return 1;
 0119            if (this.Iso != other.Iso) return 1;
 0120            if (this.Name != other.Name) return 1;
 0121            if (this.OrdnerIndex != other.OrdnerIndex) return 1;
 0122            return 0;
 0123        }
 124
 125        public int CompareTo(ISpeaker other)
 0126        {
 0127            if (this.Id != other.Id) return 1;
 0128            if (this.Iso != other.Iso) return 1;
 0129            if (this.Name != other.Name) return 1;
 0130            if (this.OrdnerIndex != other.OrdnerIndex) return 1;
 0131            return 0;
 0132        }
 133    }
 134}