public void Xact_Detach_FailsIfThereIsTempPost() { Account account = new Account(); Xact xact = new Xact(); Post post = new Post(account); post.Flags = SupportsFlagsEnum.ITEM_TEMP; xact.AddPost(post); xact.Detach(); }
public void Xact_Detach_FailsIfThereIsTempPost() { Account account = new Account(); Xact xact = new Xact(); Post post = new Post(account); post.Flags = SupportsFlagsEnum.ITEM_TEMP; xact.AddPost(post); Assert.Throws <InvalidOperationException>(() => xact.Detach()); }
public void Xact_Detach_RemovesPostsFromAccounts() { Account account = new Account(); Xact xact = new Xact(); Post post = new Post(account); xact.AddPost(post); account.Posts.Add(post); xact.Detach(); Assert.AreEqual(0, account.Posts.Count); // Post has been removed }
public void Xact_Detach_DoesNothingIf_ITEM_TEMP() { Account account = new Account(); Xact xact = new Xact(); xact.Flags = SupportsFlagsEnum.ITEM_TEMP; Post post = new Post(account); post.Flags = SupportsFlagsEnum.ITEM_TEMP; xact.AddPost(post); account.Posts.Add(post); xact.Detach(); Assert.AreEqual(1, account.Posts.Count); // Post has not been removed }