public void CompareToOperatorWithEqualObjects()
        {
            var first = new EnvironmentId("a");
            object second = first.Clone();

            Assert.AreEqual(0, first.CompareTo(second));
        }
Example #2
0
    public string ReadNextObjectToLoad(EnvironmentId envId)
    {
        string sEnv = "";

        switch (envId)
        {
        case EnvironmentId.Stone1:
            sEnv = FindNextObject(sFileEnv1, ref env1Index);
            break;

        case EnvironmentId.Stone2:
            sEnv = FindNextObject(sFileEnv2, ref env2Index);
            break;

        case EnvironmentId.Ground1:
            sEnv = FindNextObject(sFileEnv3, ref env3Index);
            break;

        case EnvironmentId.Ice1:
            sEnv = FindNextObject(sFileEnv4, ref env4Index);
            break;

        case EnvironmentId.Tree1:
            sEnv = FindNextObject(sFileEnv5, ref env5Index);
            break;
        }
        return(sEnv);
    }
        /// <summary>
        /// Gets the hash code
        /// </summary>
        /// <returns>Hash code</returns>
        public override int GetHashCode()
        {
            unchecked // Overflow is fine, just wrap
            {
                var hashCode = 41;
                // Suitable nullity checks etc, of course :)
                if (Service != null)
                {
                    hashCode = hashCode * 59 + Service.GetHashCode();
                }
                if (Name != null)
                {
                    hashCode = hashCode * 59 + Name.GetHashCode();
                }
                if (Date != null)
                {
                    hashCode = hashCode * 59 + Date.GetHashCode();
                }

                hashCode = hashCode * 59 + ProgramId.GetHashCode();

                hashCode = hashCode * 59 + EnvironmentId.GetHashCode();
                if (Links != null)
                {
                    hashCode = hashCode * 59 + Links.GetHashCode();
                }
                return(hashCode);
            }
        }
        public void Clone()
        {
            var first = new EnvironmentId("a");
            var second = first.Clone();

            Assert.AreEqual(first, second);
        }
Example #5
0
    public void AddObjectToSave(EnvironmentId envId, string envToSave)
    {
        switch (envId)
        {
        case EnvironmentId.Stone1:
            sFileEnv1 += envToSave;
            break;

        case EnvironmentId.Stone2:
            sFileEnv2 += envToSave;
            break;

        case EnvironmentId.Ground1:
            sFileEnv3 += envToSave;
            break;

        case EnvironmentId.Ice1:
            sFileEnv4 += envToSave;
            break;

        case EnvironmentId.Tree1:
            sFileEnv5 += envToSave;
            break;
        }
    }
Example #6
0
        /// <inheritdoc/>
        protected override async Task <object> CallGitHubApi(DialogContext dc, Octokit.GitHubClient gitHubClient, CancellationToken cancellationToken = default(CancellationToken))
        {
            if (EnvironmentId != null && UpdatePreReceiveEnvironment != null)
            {
                var environmentIdValue = EnvironmentId.GetValue(dc.State);
                var updatePreReceiveEnvironmentValue = UpdatePreReceiveEnvironment.GetValue(dc.State);
                return(await gitHubClient.Enterprise.PreReceiveEnvironment.Edit((Int64)environmentIdValue, updatePreReceiveEnvironmentValue).ConfigureAwait(false));
            }

            throw new ArgumentNullException("Required [environmentId,updatePreReceiveEnvironment] arguments missing for GitHubClient.Enterprise.PreReceiveEnvironment.Edit");
        }
        /// <summary>
        /// Returns true if EnvironmentLog instances are equal
        /// </summary>
        /// <param name="other">Instance of EnvironmentLog to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(EnvironmentLog other)
        {
            if (other is null)
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     Service == other.Service ||
                     Service != null &&
                     Service.Equals(other.Service)
                     ) &&
                 (
                     Name == other.Name ||
                     Name != null &&
                     Name.Equals(other.Name)
                 ) &&
                 (
                     Date == other.Date ||
                     Date != null &&
                     Date.Equals(other.Date)
                 ) &&
                 (
                     ProgramId == other.ProgramId ||

                     ProgramId.Equals(other.ProgramId)
                 ) &&
                 (
                     EnvironmentId == other.EnvironmentId ||

                     EnvironmentId.Equals(other.EnvironmentId)
                 ) &&
                 (
                     Links == other.Links ||
                     Links != null &&
                     Links.Equals(other.Links)
                 ));
        }
        public void CompareToWithNullObject()
        {
            var first = new EnvironmentId("a");
            object second = null;

            Assert.AreEqual(1, first.CompareTo(second));
        }
        public void CompareToWithLargerFirstObject()
        {
            var first = new EnvironmentId("b");
            var second = new EnvironmentId("a");

            Assert.IsTrue(first.CompareTo(second) > 0);
        }
        public void SmallerThanOperatorWithSecondObjectNull()
        {
            var first = new EnvironmentId("a");
            EnvironmentId second = null;

            Assert.IsFalse(first < second);
        }
        public void SmallerThanOperatorWithFirstObjectNull()
        {
            EnvironmentId first = null;
            var second = new EnvironmentId("a");

            Assert.IsTrue(first < second);
        }
        public void SmallerThanOperatorWithEqualObjects()
        {
            var first = new EnvironmentId("a");
            var second = first.Clone();

            Assert.IsFalse(first < second);
        }
        public void LargerThanOperatorWithSecondObjectNull()
        {
            var first = new EnvironmentId("a");
            EnvironmentId second = null;

            Assert.IsTrue(first > second);
        }
        public void LargerThanOperatorWithFirstObjectNull()
        {
            EnvironmentId first = null;
            var second = new EnvironmentId("a");

            Assert.IsFalse(first > second);
        }
        public void CompareToWithUnequalObjectTypes()
        {
            var first = new EnvironmentId("a");
            var second = new object();

            Assert.Throws<ArgumentException>(() => first.CompareTo(second));
        }
        public void SmallerThanOperatorWithFirstObjectSmaller()
        {
            var first = new EnvironmentId("a");
            var second = new EnvironmentId("b");

            Assert.IsTrue(first < second);
        }
 public MockEnvironmentSpecification(
     EnvironmentId id,
     string contract,
     string name,
     string description,
     bool isAvailableForTest,
     bool shouldCleanAfterUse,
     string networkName,
     string macAddress,
     OperatingSystemSpecification operatingSystem,
     IEnumerable<ApplicationSpecification> installedApplications)
     : base(id, 
         contract, 
         name, 
         description, 
         isAvailableForTest, 
         shouldCleanAfterUse, 
         networkName, 
         macAddress, 
         operatingSystem, 
         installedApplications)
 {
 }