Exemplo n.º 1
0
        public static CredentialIdentifierValue GetCredentialIdentifierTypeAndValueA15(this ICredentialService s, IEnumerable <string> identifierTypeList)
        {
            foreach (var typeID in identifierTypeList)
            {
                var supportedTypes = s.GetSupportedFormatTypes(typeID);

                s.Test.Assert(supportedTypes.Any(),
                              string.Format("GetSupportedFormatTypes command returned no supported format types for CredentialIdentifierType with ID = '{0}' that is declared as supported", typeID),
                              "Check GetSupportedFormatTypes returned at least one CredentialIdentifierFormatTypeInfo for specified CredentialIdentifierType");

                CredentialIdentifierValue r = null;
                s.Test.RunStep(() =>
                {
                    foreach (var typeInfo in supportedTypes)
                    {
                        if (s.SupportedCredentialIdentifierFormatTypesA14().Contains(typeInfo.FormatType))
                        {
                            r = new CredentialIdentifierValue(typeID,
                                                              typeInfo,
                                                              CredentialIdentifierValueFactory.Create(typeInfo.FormatType, "TestValue"));
                        }
                    }
                },
                               "Create CredentialIdentifier value");

                return(r);
            }

            //Check Management tab contains value in custom format
            var flag = null != s.Test.CredentialIdentifierValueFirst || null != s.Test.CredentialIdentifierValueThird;

            s.Test.Assert(flag,
                          "'Management' tab contains no value of CredentialIdentifier in custom format",
                          "Check 'Management' tab contains value of CredentialIdentifier in custom format");

            if (null != s.Test.CredentialIdentifierValueFirst && identifierTypeList.Contains(s.Test.CredentialIdentifierValueFirst.TypeName))
            {
                return(s.Test.CredentialIdentifierValueFirst);
            }

            if (null != s.Test.CredentialIdentifierValueThird && identifierTypeList.Contains(s.Test.CredentialIdentifierValueThird.TypeName))
            {
                return(s.Test.CredentialIdentifierValueThird);
            }

            s.Test.Assert(false,
                          "'Management' tab contains no value of CredentialIdentifier in allowable custom format",
                          "Check 'Management' tab contains value of CredentialIdentifier in allowable custom format");

            return(null);
        }
Exemplo n.º 2
0
        public static void GetCredentialIdentifierTypeAndValueForTypeSupportedAtleastTwoFormatTypesA17(this ICredentialService s, IEnumerable <string> identifierTypeList,
                                                                                                       out CredentialIdentifierValue valueFirst, out CredentialIdentifierValue valueSecond)
        {
            valueFirst  = null;
            valueSecond = null;

            var firstGUIValue  = s.Test.CredentialIdentifierValueFirst;
            var secondGUIValue = s.Test.CredentialIdentifierValueSecond;

            foreach (var typeID in identifierTypeList)
            {
                var supportedTypes = s.GetSupportedFormatTypes(typeID);

                s.Test.Assert(supportedTypes.Any(),
                              string.Format("GetSupportedFormatTypes command returned no supported format types for CredentialIdentifierType with ID = '{0}' that is declared as supported", typeID),
                              "Check GetSupportedFormatTypes returned at least one CredentialIdentifierFormatTypeInfo for specified CredentialIdentifierType");

                var customFormats = new List <string>();
                if (null != firstGUIValue && firstGUIValue.TypeName == typeID)
                {
                    customFormats.Add(firstGUIValue.FormatType);
                }
                if (null != secondGUIValue && secondGUIValue.FormatType == typeID)
                {
                    customFormats.Add(secondGUIValue.FormatType);
                }
                var possibleFormatTypes = s.SupportedCredentialIdentifierFormatTypesA14().ToList();
                possibleFormatTypes.AddRange(customFormats);

                var odttSupportedTypes = supportedTypes.Where(e => possibleFormatTypes.Contains(e.FormatType));
                if (odttSupportedTypes.Count() >= 2)
                {
                    CredentialIdentifierValue valueFirstLocal  = null;
                    CredentialIdentifierValue valueSecondLocal = null;
                    s.Test.RunStep(() =>
                    {
                        foreach (var typeInfo in odttSupportedTypes)
                        {
                            if (null == valueFirstLocal)
                            {
                                if (customFormats.Contains(typeInfo.FormatType))
                                {
                                    if (null != firstGUIValue && firstGUIValue.FormatType == typeInfo.FormatType)
                                    {
                                        valueFirstLocal = firstGUIValue;
                                    }
                                    else
                                    {
                                        valueFirstLocal = secondGUIValue;
                                    }
                                }
                                else
                                {
                                    valueFirstLocal = new CredentialIdentifierValue(typeID, typeInfo, CredentialIdentifierValueFactory.Create(typeInfo.FormatType, "TestValue1"));
                                }
                            }
                            else if (null == valueSecondLocal)
                            {
                                if (customFormats.Contains(typeInfo.FormatType))
                                {
                                    if (null != firstGUIValue && firstGUIValue.FormatType == typeInfo.FormatType && firstGUIValue != valueFirstLocal)
                                    {
                                        valueSecondLocal = firstGUIValue;
                                    }
                                    else if (null != secondGUIValue && secondGUIValue.FormatType == typeInfo.FormatType)
                                    {
                                        valueSecondLocal = secondGUIValue;
                                    }
                                }
                                else
                                {
                                    valueSecondLocal = new CredentialIdentifierValue(typeID, typeInfo, CredentialIdentifierValueFactory.Create(typeInfo.FormatType, "TestValue2"));
                                }
                            }
                            else
                            {
                                break;
                            }
                        }
                    },
                                   "Create CredentialIdentifier values");

                    valueFirst  = valueFirstLocal;
                    valueSecond = valueSecondLocal;

                    return;
                }
            }

            //Check Management tab contains value in custom format

            if (null != firstGUIValue && null != secondGUIValue)
            {
                s.Test.Assert(firstGUIValue.FormatType != secondGUIValue.FormatType,
                              "'Management' tab contains no two values of CredentialIdentifier of the same custom type but in different Format types",
                              "Check 'Management' tab contains two values of CredentialIdentifier of the same custom type");
            }
            else
            {
                s.Test.Assert(false,
                              "'Management' tab contains no two values of CredentialIdentifier of the same custom type",
                              "Check 'Management' tab contains two values of CredentialIdentifier of the same custom type");
            }

            valueFirst  = firstGUIValue;
            valueSecond = secondGUIValue;
        }