Exemple #1
0
 /// <summary>
 /// Returns a value indicating whether the current <see cref="Version"/> object and a specified <see cref="Version"/> object represent the same value.
 /// </summary>
 /// <param name="obj">A <see cref="Version"/> object to compare to the current <see cref="Version"/> object, or <see cref="null"/>.</param>
 /// <returns><see cref="true"/> if every component of the current <see cref="Version"/> object matches the corresponding component of the <paramref name="obj"/> parameter; otherwise, <see cref="false"/>.</returns>
 public bool Equals(Version obj)
 {
     return
         (VersionNumber.Equals(obj.VersionNumber) &&
          ID == obj.ID &&
          Type.ID == obj.Type.ID &&
          Project.ID == obj.Project.ID &&
          Location == obj.Location);
 }
Exemple #2
0
        public static bool IsCompatibleWithTemplate(string templateVersion)
        {
            //NOTE: For now it is just simple compare of current version of model with version from template,
            // later can add more advanced compatibility check (e.g. template version A is compatible with more than 1 version od model, etc...)

            VersionNumber templVersion = new VersionNumber(templateVersion);

            return(templVersion.Equals(ApplicationVersion));
            //return Util.StringEqual(templateVersion, ApplicationVersion, true);
        }
Exemple #3
0
        public override bool Equals(object obj)
        {
            if ((obj == null) || GetType() != obj.GetType())
            {
                return(false);
            }

            var other = (ProductVersion)obj;

            return(VersionNumber.Equals(other.VersionNumber) && VersionSuffix.Equals(other.VersionSuffix));
        }
        public void ShouldBeEqual(VersionNumber a, VersionNumber b)
        {
            (a > b).Should().BeFalse();
            (b < a).Should().BeFalse();

            (a < b).Should().BeFalse();
            (b > a).Should().BeFalse();

            (a != b).Should().BeTrue();
            (a == b).Should().BeFalse();

            a.CompareTo(b).Should().Be(0);
            a.Equals(b).Should().BeTrue();

            if (b != null)
            {
                b.CompareTo(a).Should().Be(0);
                b.Equals(a).Should().BeTrue();
            }
        }
 private void EqualsTestAssert(VersionNumber v1, VersionNumber v2, bool expectedValue)
 {
     Assert.AreEqual(v1.Equals(v2), expectedValue,
                     String.Format("VersionNumber.Equals: [{0}].Equals([{1}]) returned {2}. Expected: {3}",
                                   v1.ToString(), v2.ToString(), v1.Equals(v2), expectedValue));
 }
Exemple #6
0
        private void Initialize(VersionNumber currentVersion, ProductVersionDto latestProductVersion, bool skipNewVersion)
        {
            this.currentVersion       = currentVersion;
            this.latestProductVersion = latestProductVersion;
            this.chDoNotShow.Checked  = skipNewVersion;

            bool sameVersions = currentVersion.Equals(new VersionNumber(latestProductVersion.Version));

            if (sameVersions)
            {
                htmlCurrentVersion.Text = string.Format(HTML_CURRENT_VERSION_NO_UPD_NEEDED, currentVersion);
                htmlNewVersion.Text     = string.Format(HTML_NEW_VERSION_SAME, latestProductVersion.Version);
                htmlReleaseDate.Visible = false;
                htmlChanges.Visible     = false;
                btnOk.Visible           = false;
                chDoNotShow.Visible     = false;
            }
            else
            {
                htmlCurrentVersion.Text = string.Format(HTML_CURRENT_VERSION, currentVersion);
                htmlNewVersion.Text     = string.Format(HTML_NEW_VERSION, latestProductVersion.Version);
                DateTimeOffset offset = new DateTimeOffset(latestProductVersion.Published, latestProductVersion.PublishedOffset);
                htmlReleaseDate.Text = string.Format(HTML_RELEASE_DATE, offset);

                StringBuilder changesHtml     = new StringBuilder(HTML_CHANGES_HEADER);
                var           changes         = latestProductVersion.Changes;
                var           changesFeatures = changes.Where(change => change.Type == ProductVersionChangeType.Feature).OrderBy(change => change.Order);
                var           changesIssues   = changes.Where(change => change.Type == ProductVersionChangeType.Issue).OrderBy(change => change.Order);
                var           changesOthers   = changes.Where(change => change.Type == ProductVersionChangeType.Other).OrderBy(change => change.Order);

                if (changesFeatures.Any())
                {
                    changesHtml.AppendFormat(HTML_CHANGES_CATEGORY, CHANGE_COLORS[ProductVersionChangeType.Feature],
                                             "Features", changesFeatures.Count());

                    foreach (var change in changesFeatures)
                    {
                        changesHtml.AppendFormat(HTML_CHANGES_CHANGE_ROW, CHANGE_COLORS[change.Type], change.WorkItemId,
                                                 change.Title);
                    }
                }

                if (changesIssues.Any())
                {
                    changesHtml.AppendFormat(HTML_CHANGES_CATEGORY, CHANGE_COLORS[ProductVersionChangeType.Issue],
                                             "Issues", changesIssues.Count());

                    foreach (var change in changesIssues)
                    {
                        changesHtml.AppendFormat(HTML_CHANGES_CHANGE_ROW, CHANGE_COLORS[change.Type], change.WorkItemId,
                                                 change.Title);
                    }
                }

                if (changesOthers.Any())
                {
                    changesHtml.AppendFormat(HTML_CHANGES_CATEGORY, CHANGE_COLORS[ProductVersionChangeType.Other],
                                             "Other", changesOthers.Count());

                    foreach (var change in changesOthers)
                    {
                        changesHtml.AppendFormat(HTML_CHANGES_CHANGE_ROW, CHANGE_COLORS[change.Type], change.WorkItemId,
                                                 change.Title);
                    }
                }

                changesHtml.Append(HTML_CHANGES_FOOTER);
                htmlChanges.Text = changesHtml.ToString();
            }
        }
        public bool Equals(DestinyItemComponent input)
        {
            if (input == null)
            {
                return(false);
            }

            return
                ((
                     ItemHash == input.ItemHash ||
                     (ItemHash.Equals(input.ItemHash))
                     ) &&
                 (
                     ItemInstanceId == input.ItemInstanceId ||
                     (ItemInstanceId.Equals(input.ItemInstanceId))
                 ) &&
                 (
                     Quantity == input.Quantity ||
                     (Quantity.Equals(input.Quantity))
                 ) &&
                 (
                     BindStatus == input.BindStatus ||
                     (BindStatus != null && BindStatus.Equals(input.BindStatus))
                 ) &&
                 (
                     Location == input.Location ||
                     (Location != null && Location.Equals(input.Location))
                 ) &&
                 (
                     BucketHash == input.BucketHash ||
                     (BucketHash.Equals(input.BucketHash))
                 ) &&
                 (
                     TransferStatus == input.TransferStatus ||
                     (TransferStatus != null && TransferStatus.Equals(input.TransferStatus))
                 ) &&
                 (
                     Lockable == input.Lockable ||
                     (Lockable != null && Lockable.Equals(input.Lockable))
                 ) &&
                 (
                     State == input.State ||
                     (State != null && State.Equals(input.State))
                 ) &&
                 (
                     OverrideStyleItemHash == input.OverrideStyleItemHash ||
                     (OverrideStyleItemHash.Equals(input.OverrideStyleItemHash))
                 ) &&
                 (
                     ExpirationDate == input.ExpirationDate ||
                     (ExpirationDate != null && ExpirationDate.Equals(input.ExpirationDate))
                 ) &&
                 (
                     IsWrapper == input.IsWrapper ||
                     (IsWrapper != null && IsWrapper.Equals(input.IsWrapper))
                 ) &&
                 (
                     TooltipNotificationIndexes == input.TooltipNotificationIndexes ||
                     (TooltipNotificationIndexes != null && TooltipNotificationIndexes.SequenceEqual(input.TooltipNotificationIndexes))
                 ) &&
                 (
                     MetricHash == input.MetricHash ||
                     (MetricHash.Equals(input.MetricHash))
                 ) &&
                 (
                     MetricObjective == input.MetricObjective ||
                     (MetricObjective != null && MetricObjective.Equals(input.MetricObjective))
                 ) &&
                 (
                     VersionNumber == input.VersionNumber ||
                     (VersionNumber.Equals(input.VersionNumber))
                 ) &&
                 (
                     ItemValueVisibility == input.ItemValueVisibility ||
                     (ItemValueVisibility != null && ItemValueVisibility.SequenceEqual(input.ItemValueVisibility))
                 ));
        }