本文整理汇总了C#中Account.AddTag方法的典型用法代码示例。如果您正苦于以下问题:C# Account.AddTag方法的具体用法?C# Account.AddTag怎么用?C# Account.AddTag使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Account
的用法示例。
在下文中一共展示了Account.AddTag方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AccountTags_property_returns_a_collection_of_AccountsTagViewModels_belonging_to_the_account
public void AccountTags_property_returns_a_collection_of_AccountsTagViewModels_belonging_to_the_account()
{
var tag1 = new AccountTag(1, "Entertainment");
var tag2 = new AccountTag(2, "Food");
var tag3 = new AccountTag(3, "Services");
var account = new Account(1, "HSBC current", AccountType.Asset);
account.AddTag(tag1);
account.AddTag(tag2);
account.AddTag(tag3);
var vm = new AccountViewModel(account, _mockAccountRepository, _mockAccountTagRepository);
ObservableCollection<AccountTagViewModel> tagVMs = vm.AccountTags;
var tagNames = tagVMs.Select(x => x.TagName).ToList();
Assert.AreEqual(3, tagVMs.Count);
Assert.IsTrue(tagNames.Contains("Entertainment"));
Assert.IsTrue(tagNames.Contains("Food"));
Assert.IsTrue(tagNames.Contains("Services"));
}
示例2: adding_the_same_tag_twice_does_not_result_in_duplicates_but_moves_tag_to_the_end
public void adding_the_same_tag_twice_does_not_result_in_duplicates_but_moves_tag_to_the_end()
{
var account = new Account(10001, "Halifax - SIF ISA", AccountType.Asset);
account.AddTag(_accountTag1);
account.AddTag(_accountTag1);
Assert.AreEqual(1, account.Tags.Count);
Assert.AreEqual(_accountTag1, account.Tags[0]);
account.AddTag(_accountTag2);
Assert.AreEqual(2, account.Tags.Count);
Assert.AreEqual(_accountTag1, account.Tags[0]);
Assert.AreEqual(_accountTag2, account.Tags[1]);
account.AddTag(_accountTag1);
Assert.AreEqual(2, account.Tags.Count);
Assert.AreEqual(_accountTag2, account.Tags[0]);
Assert.AreEqual(_accountTag1, account.Tags[1]);
account.AddTag(_accountTag3);
Assert.AreEqual(3, account.Tags.Count);
Assert.AreEqual(_accountTag2, account.Tags[0]);
Assert.AreEqual(_accountTag1, account.Tags[1]);
Assert.AreEqual(_accountTag3, account.Tags[2]);
account.AddTag(_accountTag2);
Assert.AreEqual(3, account.Tags.Count);
Assert.AreEqual(_accountTag1, account.Tags[0]);
Assert.AreEqual(_accountTag3, account.Tags[1]);
Assert.AreEqual(_accountTag2, account.Tags[2]);
}
示例3: can_add_tags_to_an_account
public void can_add_tags_to_an_account()
{
var account = new Account(1, "Halifax - SIF ISA", AccountType.Asset);
Assert.AreEqual(0, account.Tags.Count);
Assert.IsFalse(account.Tags.Contains(_accountTag1));
Assert.IsFalse(account.Tags.Contains(_accountTag2));
account.AddTag(_accountTag1);
Assert.AreEqual(1, account.Tags.Count);
Assert.IsTrue(account.Tags.Contains(_accountTag1));
Assert.IsFalse(account.Tags.Contains(_accountTag2));
account.AddTag(_accountTag2);
Assert.AreEqual(2, account.Tags.Count);
Assert.IsTrue(account.Tags.Contains(_accountTag1));
Assert.IsTrue(account.Tags.Contains(_accountTag2));
}
示例4: FirstMatchingTag_returns_first_tag_that_matches_any_of_the_filters
public void FirstMatchingTag_returns_first_tag_that_matches_any_of_the_filters()
{
var account1 = new Account(1, "Halifax - SIF ISA", AccountType.Asset);
var account2 = new Account(2, "HSBC - Savings", AccountType.Asset);
account1.AddTag(_accountTag1);
account1.AddTag(_accountTag2);
account2.AddTag(_accountTag4);
account2.AddTag(_accountTag1);
var tagFilter = new System.Collections.Generic.List<AccountTag> {_accountTag1, _accountTag2};
var firstMatchingTag1 = account1.FirstMatchingTag(tagFilter);
var firstMatchingTag2 = account2.FirstMatchingTag(tagFilter);
Assert.AreEqual(_accountTag1, firstMatchingTag1);
Assert.AreEqual(_accountTag1, firstMatchingTag2);
}
示例5: can_remove_a_tag_from_an_account
public void can_remove_a_tag_from_an_account()
{
var account = new Account(1, "Halifax - SIF ISA", AccountType.Asset);
account.AddTag(_accountTag1);
account.AddTag(_accountTag2);
account.RemoveTag(_accountTag1);
Assert.AreEqual(1, account.Tags.Count);
Assert.IsFalse(account.Tags.Contains(_accountTag1));
Assert.IsTrue(account.Tags.Contains(_accountTag2));
}
示例6: can_emit_xml_describing_Account
public void can_emit_xml_describing_Account()
{
var account = new Account(3, "Eating Out", AccountType.Expense) {IsEnabled = false};
account.AddTag(_accountTag2);
account.AddTag(_accountTag3);
const string expectedResult = @"<account id=""3"" name=""Eating Out"" type=""4"" isEnabled=""false"">
<tags>
<tag>2</tag>
<tag>3</tag>
</tags>
</account>";
Assert.AreEqual(expectedResult, account.EmitXml().ToString());
}
示例7: can_clear_tags
public void can_clear_tags()
{
var account = new Account(2, "Halifax - SIF ISA", AccountType.Asset);
account.AddTag(_accountTag1);
account.AddTag(_accountTag2);
account.ClearTags();
Assert.AreEqual(0, account.Tags.Count);
}
示例8: can_remove_an_AccountTag_from_an_Account_by_calling_RemoveAccountTag_method
public void can_remove_an_AccountTag_from_an_Account_by_calling_RemoveAccountTag_method()
{
var tag1 = new AccountTag(1, "Entertainment");
var tag2 = new AccountTag(2, "Food");
var tag3 = new AccountTag(3, "Services");
var account = new Account(1, "HSBC current", AccountType.Asset);
account.AddTag(tag1);
account.AddTag(tag2);
account.AddTag(tag3);
var vm = new AccountViewModel(account, _mockAccountRepository, _mockAccountTagRepository);
vm.PropertyChanged += _changeCounter.HandlePropertyChange;
ObservableCollection<AccountTagViewModel> tagVMs = vm.AccountTags;
var tagVMToRemove = tagVMs.First(x => x.TagName == "Food");
Expect.Once.On(_mockAccountRepository).Method("Save").With(account);
vm.RemoveAccountTag(tagVMToRemove, null);
var tagIdsInViewModel = tagVMs.Select(x => x.TagId).ToList();
Assert.AreEqual(2, tagVMs.Count);
Assert.IsFalse(tagIdsInViewModel.Contains(2));
Assert.IsTrue(tagIdsInViewModel.Contains(1));
Assert.IsTrue(tagIdsInViewModel.Contains(3));
Assert.AreEqual(1, _changeCounter.NoOfPropertiesChanged);
Assert.AreEqual(1, _changeCounter.TotalChangeCount);
Assert.AreEqual(1, _changeCounter.ChangeCount("AccountTags"));
_mocks.VerifyAllExpectationsHaveBeenMet();
}