Exemplo n.º 1
0
        public void ShouldNotMatchSameNameIncompatibleTypeProperties()
        {
            var source = new TwoValues {
                Value = new int[5], value = string.Empty
            };
            var target = new PublicProperty <byte>();

            var matchingSourceMember = GetMatchingSourceMember(source, target, pp => pp.Value);

            matchingSourceMember.ShouldNotBeNull();
            matchingSourceMember.Name.ShouldBe("value");
        }
Exemplo n.º 2
0
        public void ShouldNotMatchSameNameIncompatibleTypeProperties()
        {
            var source = new TwoValues {
                Value = new int[5], value = string.Empty
            };
            var target       = new PublicProperty <byte>();
            var targetMember = TargetMemberFor <PublicProperty <byte> >(x => x.Value);

            var mappingContext  = new MappingExecutor <TwoValues>(DefaultMapperContext.RuleSets.CreateNew, DefaultMapperContext);
            var rootMappingData = mappingContext.CreateRootMappingData(source, target);
            var rootMapperData  = rootMappingData.MapperData;

            var childMapperData     = new ChildMemberMapperData(targetMember, rootMapperData);
            var childMappingContext = rootMappingData.GetChildMappingData(childMapperData);

            var matchingSourceMember = SourceMemberMatcher.GetMatchFor(childMappingContext);

            matchingSourceMember.ShouldNotBeNull();
            matchingSourceMember.Name.ShouldBe("value");
        }
Exemplo n.º 3
0
    private TwoValues <int, int> GetUnlockLetterIndex(string[] progress, int numPass = 0)
    {
        int numEmpty           = 0;
        int tmpNumPass         = numPass;
        TwoValues <int, int> t = null;

        for (int i = 0; i < progress.Length; i++)
        {
            for (int j = 0; j < progress[i].Length; j++)
            {
                if (progress[i][j] == '0')
                {
                    if (t == null)
                    {
                        if (tmpNumPass == 0)
                        {
                            t = new TwoValues <int, int>(i, j);
                        }
                        else
                        {
                            tmpNumPass--;
                        }
                    }

                    numEmpty++;
                }
            }
        }

        if (numEmpty - numPass >= 2)
        {
            return(t);
        }
        else
        {
            return(null);
        }
    }