public void CanDetermineIfTagBelongsToAccount() { Account account1 = new Account(); account1.ID = 1; Account account2 = new Account(); account2.ID = 2; Tag tag = new Tag(); tag.Account = account1; Assert.IsTrue(tag.BelongsToAccount(account1), "BelongsToAccount is false."); Assert.IsFalse(tag.BelongsToAccount(account2), "BelongsToAccount is true."); }
public IList<Task> AllForTag(Tag tag, Account account) { if (!tag.BelongsToAccount(account)) throw new ApplicationException("The tag does not belong to the account."); return _repository.AllForTag(tag); }