public void Clone_ReturnsDifferentNonNullObject() { var r = new Role("code", "name", "def"); var clone = r.Clone(); Assert.IsNotNull(clone); Assert.AreNotSame(r, clone); }
public void Clone_ReturnsSameContent() { var r = new Role("dev", "developer", "def"); var c = new Contribution("name", r); c.Date = DateTime.Now; c.Comments = "stupid note"; Assert.IsTrue(c.AreContentsEqual(c.Clone() as Contribution)); }
public void Clone_ReturnsDifferentNonNullObject() { var r = new Role("dev", "developer", "def"); var c = new Contribution("name", r); var clone = c.Clone(); Assert.IsNotNull(clone); Assert.AreNotSame(c, clone); }
public void AreContentsEqual_RolesDifferent_ReturnsFalse() { var r1 = new Role("codered", null, null); var r2 = new Role("codeblue", null, null); var c1 = new Contribution("joey", r1); var c2 = new Contribution("joey", r2); Assert.IsFalse(c1.AreContentsEqual(c2)); }
/// ------------------------------------------------------------------------------------ /// <summary> /// Returns true if the contents of this Role are the same as those of the specified /// Role. /// </summary> /// ------------------------------------------------------------------------------------ public bool AreContentsEqual(Role other) { if (other == null) return false; // REVIEW: Do we really care if name and definition are different. Perhaps only // the code really matters. return (Code.Equals(other.Code) && Name.Equals(other.Name) && Definition.Equals(other.Definition)); }
public void Clone_RolesAreDifferentObject() { var r = new Role("dev", "developer", "def"); var c = new Contribution("name", r).Clone() as Contribution; Assert.AreNotSame(r, c.Role); }
public void Equals_CompareToNull_ReturnsFalse() { var r = new Role("codered", "Jaguar", "black"); Assert.IsFalse(r.Equals(null)); }
public void Equals_AllSame_ReturnsTrue() { var r1 = new Role("dev", "developer", "def"); var r2 = new Role("dev", "developer", "def"); var l1 = License.CreativeCommons_Attribution; var l2 = License.CreativeCommons_Attribution; var d1 = DateTime.Now; var c1 = new Contribution("joey", r1) { Date = d1, Comments = "get bread", ApprovedLicense = l1 }; var c2 = new Contribution("joey", r2) { Date = d1, Comments = "get bread", ApprovedLicense = l2 }; Assert.IsTrue(c1.Equals(c2)); }
public void Clone_ReturnsSameContent() { var r = new Role("code", "name", "def"); Assert.IsTrue(r.AreContentsEqual(r.Clone())); }
/// ------------------------------------------------------------------------------------ /// <summary> /// Used to look up roles in the system's controlled vocabulary /// </summary> /// ------------------------------------------------------------------------------------ public bool TryGetRoleByName(string name, out Role role) { role = GetRoles().FirstOrDefault(r => r.Name == name); return role != null; }
public void AreContentsEqual_OtherIsNull_ReturnsFalse() { var r = new Role(null, null, null); Assert.IsFalse(r.AreContentsEqual(null)); }
public void Equals_AllSame_ReturnsTrue() { var r1 = new Role("codered", "Jaguar", "black"); var r2 = new Role("codered", "Jaguar", "black"); Assert.IsTrue(r1.Equals(r2)); }
/// ------------------------------------------------------------------------------------ /// <summary> /// Used to look up roles in the system's controlled vocabulary /// </summary> /// ------------------------------------------------------------------------------------ public bool TryGetRoleByCode(string code, out Role role) { role = GetRoles().FirstOrDefault(r => r.Code == code); return role != null; }
/// ------------------------------------------------------------------------------------ public Contribution(string name, Role role) : this() { ContributorName = name; Role = role; }
public void Equals_CompareToObjOfDifferentType_ReturnsFalse() { var r = new Role("codered", "Jaguar", "black"); Assert.IsFalse(r.Equals("junk")); }
public void Equals_SameInstance_ReturnsTrue() { var r = new Role("codered", "Jaguar", "black"); Assert.IsTrue(r.Equals(r)); }
public void AreContentsEqual_AllSame_ReturnsTrue() { var r1 = new Role("codered", "Jaguar", "black"); var r2 = new Role("codered", "Jaguar", "black"); Assert.IsTrue(r1.AreContentsEqual(r2)); }
public void AreContentsEqual_DifferentDefinitions_ReturnsFalse() { var r1 = new Role("codered", "Jaguar", "black"); var r2 = new Role("codered", "Jaguar", "brown"); Assert.IsFalse(r1.AreContentsEqual(r2)); }
public void AreContentsEqual_DifferentNames_ReturnsFalse() { var r1 = new Role("codered", "Jaguar", null); var r2 = new Role("codered", "Aston Martin", null); Assert.IsFalse(r1.AreContentsEqual(r2)); }
public void AreContentsEqual_DifferentCodes_ReturnsFalse() { var r1 = new Role("codered", null, null); var r2 = new Role("codeblue", null, null); Assert.IsFalse(r1.AreContentsEqual(r2)); }