@@ -20,7 +20,11 @@ func TestBombPosition(t *testing.T) {
2020 assert .Equal (t , groundPos , bomb .Position (), "Bomb position should be LastOnGroundPosition" )
2121
2222 playerPos := r3.Vector {X : 4 , Y : 5 , Z : 6 }
23- bomb .Carrier = & Player {Position : playerPos }
23+
24+ plEntity := entityWithID (1 )
25+ plEntity .On ("Position" ).Return (playerPos )
26+
27+ bomb .Carrier = & Player {Entity : plEntity }
2428 assert .Equal (t , playerPos , bomb .Position (), "Bomb position should be Player.Position" )
2529}
2630
@@ -59,45 +63,54 @@ func TestTeamState_Members(t *testing.T) {
5963 assert .Equal (t , members , state .Members ())
6064}
6165
62- func TestTeamState_CurrentEquipmentValue (t * testing.T ) {
63- members := []* Player {{CurrentEquipmentValue : 100 }, {CurrentEquipmentValue : 200 }}
66+ func TestTeamState_EquipmentValueCurrent (t * testing.T ) {
67+ members := []* Player {
68+ playerWithProperty ("m_unCurrentEquipmentValue" , st.PropertyValue {IntVal : 100 }),
69+ playerWithProperty ("m_unCurrentEquipmentValue" , st.PropertyValue {IntVal : 200 }),
70+ }
6471 state := NewTeamState (TeamTerrorists , func (Team ) []* Player { return members })
6572
6673 assert .Equal (t , 300 , state .CurrentEquipmentValue ())
6774}
6875
69- func TestTeamState_RoundStartEquipmentValue (t * testing.T ) {
70- members := []* Player {{RoundStartEquipmentValue : 100 }, {RoundStartEquipmentValue : 200 }}
76+ func TestTeamState_EquipmentValueRoundStart (t * testing.T ) {
77+ members := []* Player {
78+ playerWithProperty ("m_unRoundStartEquipmentValue" , st.PropertyValue {IntVal : 100 }),
79+ playerWithProperty ("m_unRoundStartEquipmentValue" , st.PropertyValue {IntVal : 200 }),
80+ }
7181 state := NewTeamState (TeamTerrorists , func (Team ) []* Player { return members })
7282
7383 assert .Equal (t , 300 , state .RoundStartEquipmentValue ())
7484}
7585
76- func TestTeamState_FreezeTimeEndEquipmentValue (t * testing.T ) {
77- members := []* Player {{FreezetimeEndEquipmentValue : 100 }, {FreezetimeEndEquipmentValue : 200 }}
86+ func TestTeamState_EquipmentValueFreezeTimeEnd (t * testing.T ) {
87+ members := []* Player {
88+ playerWithProperty ("m_unFreezetimeEndEquipmentValue" , st.PropertyValue {IntVal : 100 }),
89+ playerWithProperty ("m_unFreezetimeEndEquipmentValue" , st.PropertyValue {IntVal : 200 }),
90+ }
7891 state := NewTeamState (TeamTerrorists , func (Team ) []* Player { return members })
7992
8093 assert .Equal (t , 300 , state .FreezeTimeEndEquipmentValue ())
8194}
8295
83- func TestTeamState_CashSpentThisRound (t * testing.T ) {
96+ func TestTeamState_MoneySpentThisRound (t * testing.T ) {
8497 members := []* Player {
85- {AdditionalInformation : & AdditionalPlayerInformation {CashSpentThisRound : 100 }},
86- {AdditionalInformation : & AdditionalPlayerInformation {CashSpentThisRound : 200 }},
98+ {AdditionalInformation : & AdditionalPlayerInformation {MoneySpentThisRound : 100 }},
99+ {AdditionalInformation : & AdditionalPlayerInformation {MoneySpentThisRound : 200 }},
87100 }
88101 state := NewTeamState (TeamTerrorists , func (Team ) []* Player { return members })
89102
90- assert .Equal (t , 300 , state .CashSpentThisRound ())
103+ assert .Equal (t , 300 , state .MoneySpentThisRound ())
91104}
92105
93- func TestTeamState_CashSpentTotal (t * testing.T ) {
106+ func TestTeamState_MoneySpentTotal (t * testing.T ) {
94107 members := []* Player {
95- {AdditionalInformation : & AdditionalPlayerInformation {CashSpentTotal : 100 }},
96- {AdditionalInformation : & AdditionalPlayerInformation {CashSpentTotal : 200 }},
108+ {AdditionalInformation : & AdditionalPlayerInformation {MoneySpentTotal : 100 }},
109+ {AdditionalInformation : & AdditionalPlayerInformation {MoneySpentTotal : 200 }},
97110 }
98111 state := NewTeamState (TeamTerrorists , func (Team ) []* Player { return members })
99112
100- assert .Equal (t , 300 , state .CashSpentTotal ())
113+ assert .Equal (t , 300 , state .MoneySpentTotal ())
101114}
102115
103116type demoInfoProviderMock struct {
@@ -125,9 +138,15 @@ func mockDemoInfoProvider(tickRate float64, tick int) demoInfoProvider {
125138 }
126139}
127140
128- func entityWithProperty ( propName string , value st. PropertyValue ) st. IEntity {
141+ func entityWithID ( id int ) * stfake. Entity {
129142 entity := new (stfake.Entity )
130- entity .On ("ID" ).Return (1 )
143+ entity .On ("ID" ).Return (id )
144+
145+ return entity
146+ }
147+
148+ func entityWithProperty (propName string , value st.PropertyValue ) * stfake.Entity {
149+ entity := entityWithID (1 )
131150
132151 prop := new (stfake.Property )
133152 prop .On ("Value" ).Return (value )
0 commit comments