-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathEntropyAnalysisExtensionsTests.cs
61 lines (55 loc) · 2.15 KB
/
EntropyAnalysisExtensionsTests.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
using UnitsNet.NumberExtensions.NumberToTemperature;
namespace VCRC.Tests;
public sealed class EntropyAnalysisExtensionsTests
{
private readonly IList<IEntropyAnalysable> _cycles;
private readonly IList<Temperature> _indoor;
private readonly IList<Temperature> _indoorExtended;
private readonly IList<Temperature> _outdoor;
public EntropyAnalysisExtensionsTests()
{
_indoor = Enumerable.Range(18, 5).Select(i => i.DegreesCelsius()).ToList();
_indoorExtended = Enumerable.Range(18, 6).Select(i => i.DegreesCelsius()).ToList();
_outdoor = Enumerable.Range(36, 5).Select(i => i.DegreesCelsius()).ToList();
_cycles = Enumerable
.Range(0, _indoor.Count)
.Select(i => CreateVCRC(_indoor[i], _outdoor[i]))
.ToList();
}
[Fact]
public void EntropyAnalysisInRange_ListsOfTemperaturesWithDifferentCount_ThrowsArgumentException()
{
Action action = () => _cycles.EntropyAnalysis(_indoorExtended, _outdoor);
action
.Should()
.Throw<ArgumentException>()
.WithMessage("Inputs should have the same length!");
}
[Fact]
public void EntropyAnalysisInRange_Always_ReturnsAveragedEntropyAnalysisResult() =>
_cycles
.EntropyAnalysis(_indoor, _outdoor)
.Should()
.Be(
_cycles
.Select((cycle, i) => cycle.EntropyAnalysis(_indoor[i], _outdoor[i]))
.ToList()
.Average()
);
private static IEntropyAnalysable CreateVCRC(Temperature indoor, Temperature outdoor)
{
const FluidsList refrigerantName = FluidsList.R32;
var evaporator = new Evaporator(
refrigerantName,
indoor - TemperatureDelta.FromKelvins(7),
TemperatureDelta.FromKelvins(5)
);
var compressor = new Compressor(80.Percent());
var condenser = new Condenser(
refrigerantName,
outdoor + TemperatureDelta.FromKelvins(10),
TemperatureDelta.FromKelvins(3)
);
return new SimpleVCRC(evaporator, compressor, condenser);
}
}