Ejemplo n.º 1
0
        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");
        }
Ejemplo n.º 2
0
        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");
        }
Ejemplo n.º 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);
            }
        }
Ejemplo n.º 4
0
 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");
 }
Ejemplo n.º 5
0
 public void HashCodeCanBeRetrievedWhenIdIsNull()
 {
     MixGroup mixGroup = new MixGroup();
     Assert.IsNotNull(mixGroup.GetHashCode(), "Expected a hash code");
 }