-
Notifications
You must be signed in to change notification settings - Fork 4
/
CompletenessReportShowCaseTests.cs
63 lines (59 loc) · 2.18 KB
/
CompletenessReportShowCaseTests.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using BO4E.BO;
using BO4E.COM;
using BO4E.ENUM;
using BO4E.Extensions.BusinessObjects.Energiemenge;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace TestBO4E.Reporting.ShowCaseTests;
[TestClass]
public class CompletenessReportShowCaseTests
{
[TestMethod]
public void ShowCaseTest()
{
var em = new Energiemenge
{
LokationsId = "DE0123456789012345678901234567890",
LokationsTyp = Lokationstyp.MELO,
Energieverbrauch = new List<Verbrauch>
{
new Verbrauch
{
Einheit = Mengeneinheit.KWH,
Startdatum = new DateTimeOffset(2020, 3, 1, 0, 0, 0, TimeSpan.Zero).UtcDateTime,
Enddatum = new DateTimeOffset(2020, 3, 8, 0, 0, 0, TimeSpan.Zero).UtcDateTime,
Wert = 456.0M,
Wertermittlungsverfahren = Wertermittlungsverfahren.MESSUNG,
},
new Verbrauch
{
Einheit = Mengeneinheit.KWH,
Startdatum = new DateTimeOffset(
2020,
3,
25,
0,
0,
0,
TimeSpan.Zero
).UtcDateTime,
Enddatum = new DateTimeOffset(2020, 4, 1, 0, 0, 0, TimeSpan.Zero).UtcDateTime,
Wert = 123.0M,
Wertermittlungsverfahren = Wertermittlungsverfahren.MESSUNG,
},
},
};
var cr = em.GetCompletenessReport();
Debug.WriteLine(
$"{nameof(em)} has a coverage of {decimal.Round(cr.Coverage.Value * 100.0M)}%."
);
// em has a coverage of 45%.
Debug.WriteLine(
$"{nameof(em)} has no values for the following intervals: {string.Join(", ", cr.Gaps.Select(g => g.Startdatum.ToString("yyyy-MM-dd") + " to " + g.Enddatum.ToString("yyyy-MM-dd")))}"
);
// em has no values for the following intervals: 2020-03-08 to 2020-03-25
}
}