public void TestProperties()
        {
            MixGroup group = new MixGroup() { Id = TestId, Name = TestName };

            Assert.AreEqual(TestId, group.Id, "Expected the property to persist");
            Assert.AreEqual(TestName, group.Name, "Expected the property to persist");
        }
        public void TestJsonParsing()
        {
            MixGroup group = new MixGroup() { Id = "1234", Name = "Metal" };
            JObject json = JObject.Parse("{\"id\":\"1234\",\"name\":\"Metal\"}");
            MixGroup fromJson = MixGroup.FromJToken(json) as MixGroup;

            Assert.IsNotNull(fromJson, "Expected a MixGroup object");

            Assert.IsTrue(group.Equals(fromJson), "Expected the same MixGroup");
        }
Example #3
0
        /// <summary>
        /// Determines whether the specified <see cref="System.Object" /> is equal to this instance.
        /// </summary>
        /// <param name="obj">The <see cref="System.Object" /> to compare with this instance.</param>
        /// <returns>
        ///   <c>true</c> if the specified <see cref="System.Object" /> is equal to this instance; otherwise, <c>false</c>.
        /// </returns>
        public override bool Equals(object obj)
        {
            MixGroup target = obj as MixGroup;

            if (target != null)
            {
                return(string.Compare(target.Id, this.Id, StringComparison.OrdinalIgnoreCase) == 0);
            }
            else
            {
                return(false);
            }
        }
 public void TestOverrides()
 {
     MixGroup group = new MixGroup() { Id = TestId, Name = TestName };
     Assert.IsNotNull(group.GetHashCode(), "Expected a hash code");
     Assert.IsFalse(group.Equals(TestId), "Expected inequality");
 }
 public void HashCodeCanBeRetrievedWhenIdIsNull()
 {
     MixGroup mixGroup = new MixGroup();
     Assert.IsNotNull(mixGroup.GetHashCode(), "Expected a hash code");
 }