Esempio n. 1
0
        public void TestParamConstructor()
        {
            MixGroup group = new MixGroup("1234", "Metal");

            Assert.AreEqual("1234", group.Id);
            Assert.AreEqual("Metal", group.Name);
        }
Esempio n. 2
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");
        }
Esempio n. 3
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, null) as MixGroup;

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

            Assert.IsTrue(group.Equals(fromJson), "Expected the same MixGroup");
        }
Esempio n. 4
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);
            }
        }
Esempio n. 5
0
 public void HashCodeCanBeRetrievedWhenIdIsNull()
 {
     MixGroup mixGroup = new MixGroup();
     Assert.IsNotNull(mixGroup.GetHashCode(), "Expected a hash code");
 }
Esempio n. 6
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");
 }