예제 #1
0
        public async Task Verify_that_person_can_be_Posted()
        {
            var cdpServicesDal = new CdpServicesDal();
            var dtos           = await cdpServicesDal.Open(this.credentials, this.cancelationTokenSource.Token);

            var siteDirectory = (CDP4Common.DTO.SiteDirectory)dtos.Single(x => x.ClassKind == ClassKind.SiteDirectory);

            var context            = siteDirectory.Route;
            var operationContainer = new OperationContainer(context, siteDirectory.RevisionNumber);

            var person = new CDP4Common.DTO.Person(Guid.NewGuid(), 1);

            person.ShortName = Guid.NewGuid().ToString();
            person.Surname   = Guid.NewGuid().ToString();
            person.GivenName = Guid.NewGuid().ToString();
            person.AddContainer(ClassKind.SiteDirectory, siteDirectory.Iid);

            var operation1 = new Operation(null, person, OperationKind.Create);

            operationContainer.AddOperation(operation1);

            var siteDirectoryClone = siteDirectory.DeepClone <CDP4Common.DTO.SiteDirectory>();

            siteDirectoryClone.Person.Add(person.Iid);
            var operation2 = new Operation(siteDirectory, siteDirectoryClone, OperationKind.Update);

            operationContainer.AddOperation(operation2);

            var result = await cdpServicesDal.Write(operationContainer);

            var resultPerson = (CDP4Common.DTO.Person)result.Single(x => x.Iid == person.Iid);

            Assert.NotNull(resultPerson);
        }
예제 #2
0
        public async Task Verify_that_person_can_be_Posted()
        {
            var uri         = new Uri("http://ocdt-dev.rheagroup.com");
            var credentials = new Credentials("admin", "pass", uri);

            var wspdal = new WspDal();
            var dtos   = await wspdal.Open(credentials, this.cancelationTokenSource.Token);

            var siteDirectory = (CDP4Common.DTO.SiteDirectory)dtos.Single(x => x.ClassKind == ClassKind.SiteDirectory);

            var context            = siteDirectory.Route;
            var operationContainer = new OperationContainer(context, siteDirectory.RevisionNumber);

            var person = new CDP4Common.DTO.Person(Guid.NewGuid(), 1);

            person.ShortName = Guid.NewGuid().ToString();
            person.Surname   = Guid.NewGuid().ToString();
            person.GivenName = Guid.NewGuid().ToString();
            person.AddContainer(ClassKind.SiteDirectory, Guid.Parse("eb77f3e1-a0f3-412d-8ed6-b8ce881c0145"));

            var operation1 = new Operation(null, person, OperationKind.Create);

            operationContainer.AddOperation(operation1);

            var siteDirectoryClone = siteDirectory.DeepClone <CDP4Common.DTO.SiteDirectory>();

            siteDirectoryClone.Person.Add(person.Iid);
            var operation2 = new Operation(siteDirectory, siteDirectoryClone, OperationKind.Update);

            operationContainer.AddOperation(operation2);

            var result = await wspdal.Write(operationContainer);

            var resultPerson = (CDP4Common.DTO.Person)result.Single(x => x.Iid == person.Iid);

            Assert.NotNull(resultPerson);
        }