예제 #1
0
        public void Entity_Doesnt_Exist_Flow()
        {
            #region Prepare
            var inputObject = new InputObject()
            {
                Entities = new List <Entity>()
                {
                    new Entity()
                    {
                        ID = 1
                    },
                    new Entity()
                    {
                        ID = 3
                    },
                    new Entity()
                    {
                        ID = 2
                    },
                }
            };

            var entityId = 99;
            #endregion

            #region Assert
            Assert.Throws <RootObjectNotFound>(() => _cloneProcessor.GetInitialEntity(inputObject, entityId));
            #endregion
        }
예제 #2
0
        public void Handle_All_With_Data()
        {
            #region Prepare
            var inputObject = new InputObject()
            {
                Entities = new List <Entity>()
                {
                    new Entity()
                    {
                        ID   = 1,
                        Name = "Something 1"
                    },
                    new Entity()
                    {
                        ID   = 2,
                        Name = "Something 2"
                    },
                    new Entity()
                    {
                        ID   = 3,
                        Name = "Something 3"
                    },
                },
                Links = new List <Link>()
                {
                    new Link()
                    {
                        FromEntityId = 1,
                        ToEntityId   = 2
                    },

                    new Link()
                    {
                        FromEntityId = 1,
                        ToEntityId   = 3
                    },

                    new Link()
                    {
                        FromEntityId = 2,
                        ToEntityId   = 3
                    }
                }
            };

            var originalEntity     = _cloneProcessor.GetInitialEntity(inputObject, 2);
            var originalEntityCopy = _cloneProcessor.CreateCloneAndAssignId(inputObject, originalEntity);
            #endregion

            #region Act
            _cloneProcessor.HandleAllTo(inputObject, originalEntity, originalEntityCopy);
            #endregion

            #region Assert
            Assert.Equal(4, inputObject.Links.Count);
            #endregion
        }