< Summary

Information
Class: MRA.Infrastructure.Database.Documents.MongoDb.CollectionMongoDocument
Assembly: MRA.Infrastructure
File(s): D:\a\MiguelRomerART\MiguelRomerART\MRA.Infrastructure\Database\Documents\MongoDb\CollectionMongoDocument.cs
Line coverage
0%
Covered lines: 0
Uncovered lines: 10
Coverable lines: 10
Total lines: 35
Line coverage: 0%
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_name()100%210%
get_description()100%210%
get_order()100%210%
get_drawingIds()100%210%
GetId()100%210%
SetDocumentAsync()100%210%

File(s)

D:\a\MiguelRomerART\MiguelRomerART\MRA.Infrastructure\Database\Documents\MongoDb\CollectionMongoDocument.cs

#LineLine coverage
 1using Google.Cloud.Firestore;
 2using MongoDB.Bson.Serialization.Attributes;
 3using MongoDB.Bson;
 4using MRA.Infrastructure.Database.Documents.Interfaces;
 5using MongoDB.Driver;
 6using MRA.Infrastructure.Database.Providers;
 7
 8namespace MRA.Infrastructure.Database.Documents.MongoDb;
 9
 10public class CollectionMongoDocument : MongoDocumentBase, ICollectionDocument
 11{
 12    [BsonElement("name")]
 013    public string name { get; set; }
 14
 15    [BsonElement("description")]
 016    public string description { get; set; }
 17
 18    [BsonElement("order")]
 019    public int order { get; set; }
 20
 21    [BsonElement("drawingIds")]
 022    public IEnumerable<string> drawingIds { get; set; }
 23
 024    public string GetId() => Id;
 25
 26    public override async Task<ReplaceOneResult> SetDocumentAsync(IMongoDatabase database, string collection, string doc
 27    {
 028        var mongoCollection = database.GetCollection<CollectionMongoDocument>(collection);
 29
 030        var filter = Builders<CollectionMongoDocument>.Filter.Eq(MongoDbDatabase.ID_FIELD, documentId);
 031        var options = new ReplaceOptions { IsUpsert = true };
 32
 033        return await mongoCollection.ReplaceOneAsync(filter, this, options);
 034    }
 35}