Exemple #1
0
        public void PositionalValueNotAddedIfMoreThanOneMissingValueExists()
        {
            SegmentArgumentParser key;

            SegmentArgumentParser.TryParseKeysFromUri("6", out key, false);
            var newKey = KeyFinder.FindAndUseKeysFromRelatedSegment(
                key,
                new List <IEdmStructuralProperty>()
            {
                HardCodedTestModel.GetLionId1Property(),
                HardCodedTestModel.GetLionId2Property(),
                HardCodedTestModel.GetLionAttackDatesProp()
            },
                HardCodedTestModel.GetPersonMyLionsNavProp(),
                new KeySegment(
                    new List <KeyValuePair <string, object> >()
            {
                new KeyValuePair <string, object>("ID", 32)
            },
                    HardCodedTestModel.GetPersonType(),
                    HardCodedTestModel.GetPeopleSet()));

            newKey.Should().Be(key);
        }
Exemple #2
0
        public void LookForKeysOnBothCurrentNavPropAndPartnerIfItExistsWorksForTemplate()
        {
            SegmentArgumentParser key;

            SegmentArgumentParser.TryParseKeysFromUri("{6}", out key, true);
            var newKey = KeyFinder.FindAndUseKeysFromRelatedSegment(
                key,
                new List <IEdmStructuralProperty>()
            {
                HardCodedTestModel.GetLionId1Property(),
                HardCodedTestModel.GetLionId2Property()
            },
                HardCodedTestModel.GetDogLionWhoAteMeNavProp(),
                new KeySegment(
                    new List <KeyValuePair <string, object> >()
            {
                new KeyValuePair <string, object>("ID", 32)
            },
                    HardCodedTestModel.GetPersonType(),
                    HardCodedTestModel.GetPeopleSet()));

            newKey.NamedValues.Should().Contain(new KeyValuePair <string, string>("ID1", "32"))
            .And.Contain(new KeyValuePair <string, string>("ID2", "{6}"));
        }
Exemple #3
0
        public void PositionalValueAddedAsMissingValueIfOnlyOneMissingValueExists()
        {
            SegmentArgumentParser key;

            SegmentArgumentParser.TryParseKeysFromUri("6", out key, false);
            var newKey = KeyFinder.FindAndUseKeysFromRelatedSegment(
                key,
                new List <IEdmStructuralProperty>()
            {
                HardCodedTestModel.GetLionId1Property(),
                HardCodedTestModel.GetLionId2Property()
            },
                HardCodedTestModel.GetPersonMyLionsNavProp(),
                new KeySegment(
                    new List <KeyValuePair <string, object> >()
            {
                new KeyValuePair <string, object>("ID", 32)
            },
                    HardCodedTestModel.GetPersonType(),
                    HardCodedTestModel.GetPeopleSet()));

            newKey.NamedValues.Should().Contain(new KeyValuePair <string, string>("ID1", "32"))
            .And.Contain(new KeyValuePair <string, string>("ID2", "6"));
        }
Exemple #4
0
        public void IfValueAlreadySpecifiedInRawKeyItIsNotOverwritten()
        {
            SegmentArgumentParser key;

            SegmentArgumentParser.TryParseKeysFromUri("ID1=6", out key, false);
            var newKey = KeyFinder.FindAndUseKeysFromRelatedSegment(
                key,
                new List <IEdmStructuralProperty>()
            {
                HardCodedTestModel.GetLionId1Property(),
                HardCodedTestModel.GetLionId2Property()
            },
                HardCodedTestModel.GetPersonMyLionsNavProp(),
                new KeySegment(
                    new List <KeyValuePair <string, object> >()
            {
                new KeyValuePair <string, object>("ID", 32)
            },
                    HardCodedTestModel.GetPersonType(),
                    HardCodedTestModel.GetPeopleSet()));

            newKey.NamedValues.Should().ContainKey("ID1")
            .And.ContainValue("6");
        }
Exemple #5
0
        public void LookForKeysOnBothCurrentNavPropAndPartnerIfItExists()
        {
            SegmentArgumentParser key;

            SegmentArgumentParser.TryParseKeysFromUri("6", out key, false);
            var newKey = KeyFinder.FindAndUseKeysFromRelatedSegment(
                key,
                new List <IEdmStructuralProperty>()
            {
                HardCodedTestModel.GetLionId1Property(),
                HardCodedTestModel.GetLionId2Property()
            },
                HardCodedTestModel.GetDogLionWhoAteMeNavProp(),
                new KeySegment(
                    new List <KeyValuePair <string, object> >()
            {
                new KeyValuePair <string, object>("ID", 32)
            },
                    HardCodedTestModel.GetPersonType(),
                    HardCodedTestModel.GetPeopleSet()));

            Assert.Contains(newKey.NamedValues, kvp => kvp.Key == "ID1" && kvp.Value == "32");
            Assert.Contains(newKey.NamedValues, kvp => kvp.Key == "ID2" && kvp.Value == "6");
        }
        private bool IsKey(SelectExpression source, HashSet <ColumnExpression> columns)
        {
            var keys = KeyFinder.Keys(source);

            return(keys.All(k => k != null && columns.Contains(k)));
        }
Exemple #7
0
    private void AdjustTapKey(AudioClip audioClip, CutEffectPlayer cutEffect)
    {
        float pitch = KeyFinder.AdjustPitch(audioClip, 21); //KeyFinder側に定数マクロを持つべきだが...

        cutEffect.SetPitch(pitch);
    }
Exemple #8
0
 /// <summary>
 /// Initializes a new instance of the class using the provided delegate as the
 /// key finder for this <see cref="IdentifiedCollection{TKey,TItem}"/> and using
 /// the default key equality
 /// keyComparer.
 /// </summary>
 /// <param name="keyFinder">A delegate following the contract of <see cref="KeyFinder"/>.</param>
 public IdentifiedCollection(KeyFinder keyFinder)
     : this(keyFinder, null)
 {
 }