public void Should_not_be_equal_when_roles_count_differ() { var instance1 = new RequireAllRolesPolicy("Editor", "Writer"); var instance2 = new RequireAllRolesPolicy("Writer"); Assert.That(instance1.Equals(instance2), Is.False); Assert.That(instance1 == instance2, Is.False); Assert.That(instance1 != instance2, Is.True); var instance3 = new RequireAllRolesPolicy(UserRole.Owner, UserRole.Writer, UserRole.Publisher); var instance4 = new RequireAllRolesPolicy(UserRole.Owner); Assert.That(instance3.Equals(instance4), Is.False); Assert.That(instance3 == instance4, Is.False); Assert.That(instance3 != instance4, Is.True); }
public void Should_be_equal() { var instance1 = new RequireAllRolesPolicy("Editor"); var instance2 = new RequireAllRolesPolicy("Editor"); Assert.That(instance1.Equals(instance2), Is.True); Assert.That(instance1 == instance2, Is.True); Assert.That(instance1 != instance2, Is.False); var instance3 = new RequireAllRolesPolicy(UserRole.Writer); var instance4 = new RequireAllRolesPolicy(UserRole.Writer); Assert.That(instance3.Equals(instance4), Is.True); Assert.That(instance3 == instance4, Is.True); Assert.That(instance3 != instance4, Is.False); }
public void Should_not_be_equal_when_comparing_to_null() { var instance = new RequireAllRolesPolicy("Editor"); Assert.That(instance.Equals(null), Is.False); }