コード例 #1
0
        public void AddNewDtoTest()
        {
            var dtos = new HashSet <DomainObjectDTO>();
            // 1. Add barebones LP.
            const string lpGuid = "9719A466-2240-4DEA-9722-9FE0746A30A6";

            CreatoDTO(dtos, lpGuid, "LangProject", null);
            const string lexDbGuid = "6C84F84A-5B99-4CF5-A7D5-A308DDC604E0";

            CreatoDTO(dtos, lexDbGuid, "LexDb", null);
            IDomainObjectDTORepository dtoRepos = new DomainObjectDtoRepository(1, dtos, m_mdc, null, TestDirectoryFinder.LcmDirectories);

            // Create new DTO and add it.
            var newGuid = Guid.NewGuid();
            var newby   = new DomainObjectDTO(newGuid.ToString(), "LexEntry", "<rt />");

            dtoRepos.Add(newby);
            Assert.AreSame(newby, dtoRepos.GetDTO(newGuid.ToString()), "Wrong new DTO from guid.");
            Assert.AreSame(newby, dtoRepos.AllInstancesSansSubclasses("LexEntry").First(), "Wrong new DTO from class.");
            Assert.IsTrue(((DomainObjectDtoRepository)dtoRepos).Newbies.Contains(newby), "Newby not in newbies set.");
        }