Summary

Class:ProjectX.UserEntityExtensions
Assembly:ProjectX
File(s):C:\private\projects\projectx\backend\src\ProjectX\Extensions\UserEntityExtensions.cs
Covered lines:4
Uncovered lines:1
Coverable lines:5
Total lines:36
Line coverage:80%

History

Metrics

MethodCyclomatic complexity  NPath complexity  Sequence coverage  Branch coverage  
IsNew(...)20100100
IsOwnerOf(...)20100100
IsOwnerOf(...)1000

File(s)

C:\private\projects\projectx\backend\src\ProjectX\Extensions\UserEntityExtensions.cs

#LineLine coverage
 1using System;
 2using ProjectX.Entities;
 3
 4namespace ProjectX
 5{
 6    public static class UserEntityExtensions
 7    {
 8        /// <summary>
 9        /// Indicates if user has to provide profile information
 10        /// </summary>
 11        /// <param name="user"></param>
 12        /// <returns></returns>
 13        public static bool IsNew(this User user)
 14        {
 315            return user.Gender == Gender.None &&
 316                        String.IsNullOrWhiteSpace(user.Name);
 17        }
 18
 19        /// <summary>
 20        /// Indicates if user is owner of <see cref="Event"/>
 21        /// </summary>
 22        /// <param name="user"></param>
 23        /// <param name="evnt"></param>
 24        /// <returns></returns>
 25        public static bool IsOwnerOf(this User user, Event entity)
 26        {
 327            return entity.CreatedById.HasValue &&
 328                user.Id.Equals(entity.CreatedById);
 29        }
 30
 31        public static bool IsOwnerOf(this User user, Participation entity)
 32        {
 033            return user.Id.Equals(entity.UserId);
 34        }
 35    }
 36}