예제 #1
0
        public void Proposal_ToString()
        {
            var proposal = new Proposal("Proposal");

            Assert.AreEqual(@"Proposal { Title: ""Proposal"", Sections: [] }", proposal.ToString());

            proposal.Add(new Section("Section"));
            Assert.AreEqual(@"Proposal { Title: ""Proposal"", Sections: [Section { Title: ""Section"", Subsections: [] }] }", proposal.ToString());

            proposal.Add(new Section("セクション2", new Subsection("第三款")));
            Assert.AreEqual(@"Proposal { Title: ""Proposal"", Sections: [Section { Title: ""Section"", Subsections: [] }, Section { Title: ""セクション2"", Subsections: [Subsection { Title: ""第三款"" }] }] }", proposal.ToString());
        }
예제 #2
0
        public void Proposal_AddSections()
        {
            var proposal = new Proposal("proposal");
            var section  = new Section("section");

            proposal.Add(section);
            CollectionAssert.AreEqual(new[] { section }, proposal.Sections.ToArray());
        }
예제 #3
0
        public void ProposalRepository_CanStore()
        {
            var repo     = new ProposalRepository();
            var proposal = new Proposal("мое славное предложение");
            var section  = new Section("секция 1", new Subsection("первый подраздел"));

            proposal.Add(section);
            repo.Store(proposal); // without error
        }
예제 #4
0
        public void Proposal_AddMultipleSections()
        {
            var proposal = new Proposal("proposal");
            var section1 = new Section("section 1");
            var section2 = new Section("section 2");

            proposal.Add(section1, section2);
            CollectionAssert.AreEqual(new[] { section1, section2 }, proposal.Sections.ToArray());
        }
예제 #5
0
        public void ProposalRepository_CanRetrieve()
        {
            var repo     = new ProposalRepository();
            var proposal = new Proposal("мое славное предложение");
            var section  = new Section("секция 1", new Subsection("первый подраздел"));

            proposal.Add(section);
            repo.Store(proposal); // without error

            var actual = repo.Retrieve(proposal.Id);

            Assert.AreEqual(proposal, actual);
        }
예제 #6
0
        public void Proposal_AddAtPosition()
        {
            var proposal = new Proposal("セクション");
            var section1 = new Section("セクション1");
            var section2 = new Section("セクション2");

            proposal.Add(section1, section2);
            CollectionAssert.AreEqual(new[] { section1, section2 }, proposal.Sections.ToArray());

            var section3 = new Section("セクション3");

            proposal.AddAt(2, section3);
            CollectionAssert.AreEqual(new[] { section1, section3, section2 }, proposal.Sections.ToArray());
        }