-
Notifications
You must be signed in to change notification settings - Fork 5
/
EvTypeInputTest.groovy
59 lines (50 loc) · 1.79 KB
/
EvTypeInputTest.groovy
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
/*
* © 2024. TU Dortmund University,
* Institute of Energy Systems, Energy Efficiency and Energy Economics,
* Research group Distribution grid planning and operation
*/
package edu.ie3.datamodel.models.input.system.type
import static edu.ie3.datamodel.models.StandardUnits.ENERGY_IN
import edu.ie3.test.common.SystemParticipantTestData
import spock.lang.Specification
import tech.units.indriya.quantity.Quantities
class EvTypeInputTest extends Specification {
def "A EvTypeInput copy method should work as expected"() {
given:
def evTypeInput = SystemParticipantTestData.evTypeInput
when:
def alteredUnit = evTypeInput.copy()
.seteStorage(Quantities.getQuantity(150, ENERGY_IN))
.build()
then:
alteredUnit.with {
assert uuid == evTypeInput.uuid
assert id == evTypeInput.id
assert capex == evTypeInput.capex
assert opex == evTypeInput.opex
assert eStorage == Quantities.getQuantity(150, ENERGY_IN)
assert eCons == evTypeInput.eCons
assert sRated == evTypeInput.sRated
assert sRatedDC == evTypeInput.sRatedDC
assert cosPhiRated == evTypeInput.cosPhiRated
}
}
def "Scaling a EvTypeInput via builder should work as expected"() {
given:
def evTypeInput = SystemParticipantTestData.evTypeInput
when:
def alteredUnit = evTypeInput.copy().scale(2d).build()
then:
alteredUnit.with {
assert uuid == evTypeInput.uuid
assert id == evTypeInput.id
assert capex == evTypeInput.capex * 2d
assert opex == evTypeInput.opex
assert eStorage == evTypeInput.eStorage * 2d
assert eCons == evTypeInput.eCons * 2d
assert sRated == evTypeInput.sRated * 2d
assert sRatedDC == evTypeInput.sRatedDC * 2d
assert cosPhiRated == evTypeInput.cosPhiRated
}
}
}