예제 #1
0
        public void ToApiRestorePreviousVersionsRequest()
        {
            // ARRANGE
            string             expectedStrategyValue = "overwrite";
            ResolutionStrategy expectedStrategy      = ResolutionStrategy.Overwrite;

            ApiRestorePreviousVersionsRequest expected = FactoryNode.ApiRestorePreviousVersionsRequest;

            expected.ResolutionStrategy = expectedStrategyValue;

            RestorePreviousVersionsRequest param = new RestorePreviousVersionsRequest(expected.DeletedNodeIds)
            {
                KeepShareLinks     = expected.KeepShareLinks,
                NewParentNodeId    = expected.ParentId,
                ResolutionStrategy = expectedStrategy
            };

            Mock.Arrange(() => EnumConverter.ConvertResolutionStrategyToValue(expectedStrategy)).Returns(expectedStrategyValue);

            // ACT
            ApiRestorePreviousVersionsRequest actual = NodeMapper.ToApiRestorePreviousVersionsRequest(param);

            // ASSERT
            Assert.Equal(expected, actual, new ApiRestorePreviousVersionsRequestComparer());
        }
 /// <include file = "UserRequestsDoc.xml" path='docs/members[@name="moveNodesRequest"]/MoveNodesRequestConstructor/*'/>
 public MoveNodesRequest(long targetNodeId, List <MoveNode> nodesToBeMoved,
                         ResolutionStrategy resolutionStrategy = ResolutionStrategy.AutoRename, bool keepShareLinks = false)
 {
     TargetNodeId       = targetNodeId;
     NodesToBeMoved     = nodesToBeMoved;
     ResolutionStrategy = resolutionStrategy;
     KeepShareLinks     = keepShareLinks;
 }
예제 #3
0
 /// <include file="UserRequestsDoc.xml" path='docs/members[@name="copyNodesRequest"]/RestorePreviousVersionsRequestConstructor/*'/>
 public RestorePreviousVersionsRequest(List <long> restoreVersionIds, ResolutionStrategy resolutionStrategy = ResolutionStrategy.AutoRename,
                                       bool keepShareLinks = false, long?newParentNodeId = null)
 {
     RestoreVersionIds  = restoreVersionIds;
     ResolutionStrategy = resolutionStrategy;
     NewParentNodeId    = newParentNodeId;
     KeepShareLinks     = keepShareLinks;
 }
        public void ConvertResolutionStrategyToValue(ResolutionStrategy value, string expected)
        {
            // ARRANGE

            // ACT
            string actual = EnumConverter.ConvertResolutionStrategyToValue(value);

            // ASSERT
            Assert.Equal(expected, actual);
        }
예제 #5
0
 public ContainerContext(IContainerContext parentContext, ResolutionStrategy resolutionStrategy,
                         ExpressionFactory expressionFactory, ContainerConfiguration containerConfiguration)
 {
     this.ContainerConfiguration = containerConfiguration;
     this.ParentContext          = parentContext;
     this.RegistrationRepository = new RegistrationRepository(containerConfiguration);
     this.DecoratorRepository    = new DecoratorRepository();
     this.RootScope          = new ResolutionScope(expressionFactory, this);
     this.ResolutionStrategy = resolutionStrategy;
 }
 /// <include file = "UserRequestsDoc.xml" path='docs/members[@name="fileUploadRequest"]/FileUploadRequestConstructor/*'/>
 public FileUploadRequest(long parentId, string name, Classification?classification = null,
                          ResolutionStrategy resolutionStrategy = ResolutionStrategy.AutoRename, string notes = null, DateTime?expirationDate = null)
 {
     ParentId           = parentId;
     Name               = name;
     Classification     = classification;
     ResolutionStrategy = resolutionStrategy;
     Notes              = notes;
     ExpirationDate     = expirationDate;
 }
예제 #7
0
        private StashboxContainer(IStashboxContainer parentContainer, ServiceRegistrator serviceRegistrator,
                                  RegistrationBuilder registrationBuilder, ResolutionStrategy resolutionStrategy, ExpressionFactory expressionFactory,
                                  ExpressionBuilder expressionBuilder, ContainerConfigurator containerConfigurator, Action <ContainerConfigurator> config = null)
            : this(expressionFactory, serviceRegistrator, registrationBuilder, containerConfigurator, config)
        {
            this.resolutionStrategy = resolutionStrategy;
            this.expressionBuilder  = expressionBuilder;

            this.ContainerContext = new ContainerContext(parentContainer.ContainerContext, resolutionStrategy,
                                                         expressionFactory, this.containerConfigurator.ContainerConfiguration);
        }
예제 #8
0
        /// <summary>
        /// Constructs a <see cref="StashboxContainer"/>.
        /// </summary>
        public StashboxContainer(Action <ContainerConfigurator> config = null)
            : this(new ExpressionFactory(), new ServiceRegistrator(),
                   new RegistrationBuilder(), new ContainerConfigurator(), config)
        {
            this.expressionBuilder  = new ExpressionBuilder(this.expressionFactory);
            this.resolutionStrategy = new ResolutionStrategy(this.expressionBuilder);

            this.ContainerContext = new ContainerContext(null, resolutionStrategy,
                                                         expressionFactory, this.containerConfigurator.ContainerConfiguration);

            this.RegisterResolvers();
        }
예제 #9
0
        public static string ConvertResolutionStrategyToValue(ResolutionStrategy strategy)
        {
            switch (strategy)
            {
            case ResolutionStrategy.AutoRename:
                return("autorename");

            case ResolutionStrategy.Fail:
                return("fail");

            case ResolutionStrategy.Overwrite:
                return("overwrite");

            default:
                return(null);
            }
        }
예제 #10
0
        private static void ArcsToPoints(CornerRounderContext context, IList <Vector3> target)
        {
            CornerRounderConfig config   = context.config;
            ResolutionStrategy  strategy = config.cornerResolutionStrategy;

            LinkedList <CornerInfo> cornerInfo = context.cornerInfo;

            float stepFactor = 1.0f / config.cornerResolution;

            target.Clear();
            foreach (var corner in cornerInfo)
            {
                if (!corner.isRounded)
                {
                    target.Add(corner.vertex);
                }
                else
                {
                    switch (strategy)
                    {
                    case ResolutionStrategy.Directly:
                        target.Add(corner.arcPoint1);
                        target.Add(corner.arcPoint2);
                        break;

                    case ResolutionStrategy.ByAngle:
                        MathUtils.ArcToPoints(corner, stepFactor, target);
                        break;

                    case ResolutionStrategy.ByArc:
                        MathUtils.ArcToPoints(corner, stepFactor * (corner.arcCenter - corner.arcPoint1).magnitude, target);
                        break;
                    }
                }
            }
        }
예제 #11
0
        public void ToApiCompleteFileUpload()
        {
            // ARRANGE
            ResolutionStrategy paramStrategy    = ResolutionStrategy.Overwrite;
            string             expectedStrategy = "overwrite";

            ApiCompleteFileUpload expected = FactoryFile.ApiCompleteFileUpload;

            expected.FileKey            = null;
            expected.ResolutionStrategy = expectedStrategy;

            FileUploadRequest param = new FileUploadRequest(63534, expected.FileName)
            {
                ResolutionStrategy = paramStrategy
            };

            Mock.Arrange(() => EnumConverter.ConvertResolutionStrategyToValue(paramStrategy)).Returns(expectedStrategy);

            // ACT
            ApiCompleteFileUpload actual = FileMapper.ToApiCompleteFileUpload(param);

            // ASSERT
            Assert.Equal(expected, actual, new ApiCompleteFileUploadComparer());
        }
예제 #12
0
파일: Fight.cs 프로젝트: w1r2p1/unitrpg
 public Fight(Participants participants, AttackType type, ResolutionStrategy strategy)
 {
     Attack       = type;
     Participants = participants;
     Strategy     = strategy;
 }