Exemplo n.º 1
0
        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();
        }
Exemplo n.º 2
0
        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());
        }
Exemplo n.º 3
0
        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
        }
Exemplo n.º 4
0
        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
        }