< Summary

Class:MUNity.Database.Models.User.MunityUser
Assembly:MUNity.Database
File(s):C:\Users\aeuke\source\repos\PeerConradi\munity\src\MUNityDatabase\Models\User\MunityUser.cs
Covered lines:23
Uncovered lines:24
Coverable lines:47
Total lines:128
Line coverage:48.9% (23 of 47)
Covered branches:0
Total branches:13
Branch coverage:0% (0 of 13)
Covered methods:15
Total methods:32
Method coverage:46.8% (15 of 32)

Metrics

MethodBranch coverage Cyclomatic complexity Line coverage
get_Title()100%10%
get_Forename()100%1100%
get_Lastname()100%1100%
get_Gender()100%10%
get_Birthday()100%1100%
get_Country()100%1100%
get_Street()100%10%
get_Zipcode()100%1100%
get_City()100%1100%
get_HouseNumber()100%1100%
get_ProfileImageName()100%10%
get_RegistrationDate()100%10%
get_LastOnline()100%10%
get_UserState()100%10%
get_CreatedResolutions()100%10%
get_Notifications()100%10%
get_Friends()100%1100%
get_InverseFriends()100%1100%
get_BlockedUsers()100%1100%
get_BlockedBy()100%1100%
get_PublicNameDisplayMode()100%10%
get_InternalNameDisplayMode()100%10%
get_ConferenceNameDisplayMode()100%10%
get_ConferenceHistoryDisplayMode()100%10%
get_FriendslistDisplayMode()100%10%
get_PinboardDisplayMode()100%10%
get_AgeDisplayMode()100%10%
get_IsShadowUser()100%1100%
get_InviteSecret()100%1100%
get_GetDisplayNamePublic()0%130%
.ctor()100%1100%
.ctor(...)100%1100%

File(s)

C:\Users\aeuke\source\repos\PeerConradi\munity\src\MUNityDatabase\Models\User\MunityUser.cs

#LineLine coverage
 1using System;
 2using System.Collections.Generic;
 3using System.ComponentModel.DataAnnotations;
 4using System.ComponentModel.DataAnnotations.Schema;
 5using System.Linq;
 6using System.Runtime.Serialization;
 7using System.Text.Json.Serialization;
 8using System.Threading.Tasks;
 9using Microsoft.AspNetCore.Identity;
 10using MUNity.Base;
 11using MUNity.Database.Models.User;
 12using MUNityCore.Models.User;
 13
 14
 15namespace MUNity.Database.Models.User
 16{
 17
 18    /// <summary>
 19    /// a registered user on the platform. Do not use this Model
 20    /// inside any of the controllers unless you use it to validate something.
 21    /// When sending out information, always use the UserSchema
 22    /// </summary>
 23    public class MunityUser : IdentityUser, IUserPrivacySettings
 24    {
 25
 26        [MaxLength(100)]
 027        public string Title { get; set; }
 28
 29        [MaxLength(250)]
 1930        public string Forename { get; set; }
 31
 32        [MaxLength(250)]
 1933        public string Lastname { get; set; }
 34
 35        [MaxLength(250)]
 036        public string Gender { get; set; }
 37
 638        public DateOnly Birthday { get; set; }  // TODO: Change to DateOnly
 39
 40        [MaxLength(300)]
 141        public string Country { get; set; }
 42
 43        [MaxLength(300)]
 044        public string Street { get; set; }
 45
 46        [MaxLength(50)]
 147        public string Zipcode { get; set; }
 48
 49        [MaxLength(300)]
 150        public string City { get; set; }
 51
 52        [MaxLength(20)]
 153        public string HouseNumber { get; set; }
 54
 55        [MaxLength(250)]
 056        public string ProfileImageName { get; set; }
 57
 058        public DateTime RegistrationDate { get; set; }
 59
 060        public DateTime LastOnline { get; set; }
 61
 062        public EUserState UserState { get; set; }
 63
 064        public ICollection<Resolution.ResolutionAuth> CreatedResolutions { get; set; }
 65
 66        //public ICollection<MunityUserRole> UserRoles { get; set; }
 67
 068        public ICollection<UserNotification> Notifications { get; set; }
 69
 2170        public ICollection<UserFriend> Friends { get; set; } = new List<UserFriend>();
 71
 2172        public ICollection<UserFriend> InverseFriends { get; set; } = new List<UserFriend>();
 73
 2174        public ICollection<UserBlocked> BlockedUsers { get; set; } = new List<UserBlocked>();
 75
 2176        public ICollection<UserBlocked> BlockedBy { get; set; } = new List<UserBlocked>();
 77
 078        public ENameDisplayMode PublicNameDisplayMode { get; set; }
 079        public ENameDisplayMode InternalNameDisplayMode { get; set; }
 080        public ENameDisplayMode ConferenceNameDisplayMode { get; set; }
 081        public EDisplayAuthMode ConferenceHistoryDisplayMode { get; set; }
 082        public EDisplayAuthMode FriendslistDisplayMode { get; set; }
 083        public EDisplayAuthMode PinboardDisplayMode { get; set; }
 084        public EDisplayAuthMode AgeDisplayMode { get; set; }
 85
 286        public bool IsShadowUser { get; set; }
 87
 88        [MaxLength(32)]
 289        public string InviteSecret { get; set; }
 90
 91        [NotMapped]
 92        public string GetDisplayNamePublic
 93        {
 94            get
 095            {
 096                switch (PublicNameDisplayMode)
 97                {
 98                    case ENameDisplayMode.FullName:
 099                        return $"{Forename} {Lastname}";
 100                    case ENameDisplayMode.FullForenameAndFirstLetterLastName:
 0101                        return $"{Forename} " + (Lastname.Length > 0 ? Lastname[0] + "." : "");
 102                    case ENameDisplayMode.FirstLetterForenameFullLastName:
 0103                        return (Forename.Length > 0 ? Forename[0] + "." : "") + $" {Lastname}";
 104                    case ENameDisplayMode.Initals:
 0105                        return (Forename.Length > 0 ? Forename[0] + "." : "") + " " + (Lastname.Length > 0 ? Lastname[0]
 106                    default:
 0107                        throw new NotImplementedException();
 108                }
 0109            }
 110        }
 111
 6112        public MunityUser()
 6113        {
 114            //this.Id = Guid.NewGuid().ToString();
 6115        }
 116
 15117        public MunityUser(string username, string email)
 15118        {
 119            //Id = Guid.NewGuid().ToString();
 15120            this.UserName = username;
 15121            this.NormalizedUserName = username.ToUpper();
 15122            this.Email = email;
 15123            this.NormalizedEmail = email.ToUpper();
 15124        }
 125
 126
 127    }
 128}