@@ -55,6 +55,8 @@ public class IntegrationResult : IIntegrationResult
55
55
private Exception sourceControlError ;
56
56
57
57
58
+
59
+
58
60
/// <summary>
59
61
/// Gets the build progress information.
60
62
/// </summary>
@@ -99,7 +101,7 @@ public IntegrationResult(string projectName, string workingDirectory, string art
99
101
100
102
CustomIntegrationProperties = lastIntegration . CustomIntegrationProperties ;
101
103
102
- this . label = this . LastIntegration . Label ;
104
+ this . Label = this . LastIntegration . Label ;
103
105
}
104
106
105
107
/// <summary>
@@ -110,7 +112,11 @@ public IntegrationResult(string projectName, string workingDirectory, string art
110
112
public string ProjectName
111
113
{
112
114
get { return projectName ; }
113
- set { projectName = value ; }
115
+ set
116
+ {
117
+ projectName = value ;
118
+ UpdateEqualsCompareValue ( ) ;
119
+ }
114
120
}
115
121
116
122
/// <summary>
@@ -143,7 +149,11 @@ public BuildCondition BuildCondition
143
149
public string Label
144
150
{
145
151
get { return label ; }
146
- set { label = value ; }
152
+ set
153
+ {
154
+ label = value ;
155
+ UpdateEqualsCompareValue ( ) ;
156
+ }
147
157
}
148
158
149
159
/// <summary>
@@ -256,7 +266,11 @@ public IntegrationStatus Status
256
266
public DateTime StartTime
257
267
{
258
268
get { return startTime ; }
259
- set { startTime = value ; }
269
+ set
270
+ {
271
+ startTime = value ;
272
+ UpdateEqualsCompareValue ( ) ;
273
+ }
260
274
}
261
275
262
276
/// <summary>
@@ -660,7 +674,7 @@ public IDictionary IntegrationProperties
660
674
fullProps [ nv . Name ] = nv . Value ;
661
675
}
662
676
}
663
-
677
+
664
678
return fullProps ;
665
679
}
666
680
}
@@ -677,10 +691,7 @@ public override bool Equals(object obj)
677
691
if ( other == null )
678
692
return false ;
679
693
680
- return ProjectName == other . ProjectName &&
681
- Status == other . Status &&
682
- Label == other . Label &&
683
- StartTime == other . StartTime ;
694
+ return string . Equals ( EqualsCompareValue , other . EqualsCompareValue ) ;
684
695
}
685
696
686
697
/// <summary>
@@ -690,9 +701,29 @@ public override bool Equals(object obj)
690
701
/// <remarks></remarks>
691
702
public override int GetHashCode ( )
692
703
{
693
- return ( ProjectName + Label + StartTime . Ticks ) . GetHashCode ( ) ;
704
+ return EqualsCompareValue . GetHashCode ( ) ;
694
705
}
695
706
707
+
708
+
709
+ string equalsCompareValue ;
710
+
711
+ /// <summary>
712
+ /// Updates equalsCompareValue so the GetHashCode and Equals function do not have to compute the value on each call
713
+ /// Value consists of : ProjectName + Label + StartTime.Ticks
714
+ /// </summary>
715
+ private void UpdateEqualsCompareValue ( )
716
+ {
717
+ equalsCompareValue = ProjectName + Label + StartTime . Ticks ;
718
+ }
719
+
720
+
721
+ internal string EqualsCompareValue
722
+ {
723
+ get { return equalsCompareValue ; }
724
+ }
725
+
726
+
696
727
/// <summary>
697
728
/// Toes the string.
698
729
/// </summary>
@@ -761,7 +792,7 @@ public virtual IIntegrationResult Clone()
761
792
clone . projectUrl = projectUrl ;
762
793
clone . buildLogDirectory = buildLogDirectory ;
763
794
clone . parameters = new List < NameValuePair > ( parameters ) ;
764
- clone . label = label ;
795
+ clone . Label = label ;
765
796
clone . modifications = ( Modification [ ] ) modifications . Clone ( ) ;
766
797
clone . status = status ;
767
798
return clone ;
0 commit comments