< Summary

Information
Class: KT.Modules.Report.Core.Domain.Report
Assembly: KT.Modules.Report
File(s): G:\NetProjects\KeepTrack\src\Modules\KT.Modules.Report\Core\Domain\Report.cs
Line coverage
100%
Covered lines: 45
Uncovered lines: 0
Coverable lines: 45
Total lines: 104
Line coverage: 100%
Branch coverage
N/A
Covered branches: 0
Total branches: 0
Branch coverage: N/A
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
get_Id()100%11100%
get_UserId()100%11100%
get_Type()100%11100%
get_Location()100%11100%
get_Title()100%11100%
get_Description()100%11100%
get_CreatedAt()100%11100%
get_UpdatedAt()100%11100%
FromCreateDto(...)100%11100%
toReportDto()100%11100%

File(s)

G:\NetProjects\KeepTrack\src\Modules\KT.Modules.Report\Core\Domain\Report.cs

#LineLine coverage
 1using KT.Modules.Report.Presentation.Dto;
 2using MongoDB.Bson;
 3using MongoDB.Bson.Serialization.Attributes;
 4
 5namespace KT.Modules.Report.Core.Domain
 6{
 7
 8    public enum Locality
 9    {
 10        Usaquen = 1,
 11        Chapinero = 2,
 12        SantaFe = 3,
 13        SanCristobal = 4,
 14        Usme = 5,
 15        Tunjuelito = 6,
 16        Bosa = 7,
 17        Kennedy = 8,
 18        Fontibon = 9,
 19        Engativa = 10,
 20        Suba = 11,
 21        BarriosUnidos = 12,
 22        Teusaquillo = 13,
 23        LosMartires = 14,
 24        AntonioNariño = 15,
 25        PuenteAranda = 16,
 26        LaCandelaria = 17,
 27        RafaelUribeUribe = 18,
 28        CiudadBolivar = 19,
 29        Sumapaz = 20
 30    }
 31
 32    public enum ReportType
 33    {
 34        Robbery = 1,
 35        Kidnapping = 2,
 36        Fight = 3,
 37        SexualHarassment = 4,
 38        Extortion = 5,
 39    }
 40
 41    internal class Location
 42    {
 43        public required float Latitude { get; set; }
 44        public required float Longitude { get; set; }
 45        public required Locality Locality { get; set; }
 46        public required string Neighbourhood { get; set; }
 47    }
 48
 49    internal class Report
 50    {
 51        [BsonId]
 2852        public string? Id { get; set; } = ObjectId.GenerateNewId().ToString();
 1753        public required string UserId { get; set; }
 54
 1955        public required ReportType Type { get; set; }
 56
 4957        public required Location Location { get; set; }
 2158        public required string Title {  get; set; }
 1959        public required string Description { get; set; }
 1960        public required DateTime CreatedAt { get; set; }
 1861        public DateTime UpdatedAt { get; set; }
 62
 63        internal static Report FromCreateDto(RequestCreateReportDto requestReport)
 164        {
 165            var location = new Location
 166            {
 167                Latitude = requestReport.Location.Latitude,
 168                Longitude = requestReport.Location.Longitude,
 169                Locality = requestReport.Location.Locality,
 170                Neighbourhood = requestReport.Location.Neighbourhood
 171            };
 72
 173            return new Report
 174            {
 175                UserId = requestReport.UserId,
 176                Location = location,
 177                Type = requestReport.Type,
 178                Description = requestReport.Description,
 179                Title = requestReport.Title,
 180                CreatedAt = DateTime.Now
 181            };
 182        }
 83
 284        internal ReportDto toReportDto() {
 285            var location = new LocationDto
 286            {
 287                Latitude = this.Location.Latitude,
 288                Longitude = this.Location.Longitude,
 289                Locality = this.Location.Locality,
 290                Neighbourhood = this.Location.Neighbourhood
 291            };
 292            return new ReportDto
 293            {
 294                Id = this.Id,
 295                Location = location,
 296                Type = this.Type,
 297                Description = this.Description,
 298                Title = this.Title,
 299                CreatedAt = this.CreatedAt,
 2100                UpdatedAt = this.UpdatedAt,
 2101            };
 2102        }
 103    }
 104}