Beispiel #1
0
        public void DocumentDetailsShouldBeAddedToProfile()
        {
            string   issuingCountry       = "GBR";
            string   documentNumber       = "1234abc";
            DateTime expirationDate       = new DateTime(2015, 5, 1);
            string   expirationDateString = expirationDate.ToString("yyyy-MM-dd");
            string   documentType         = "DRIVING_LICENCE";
            string   issuingAuthority     = "DVLA";

            string documentDetailsString = string.Format("{0} {1} {2} {3} {4}",
                                                         documentType,
                                                         issuingCountry,
                                                         documentNumber,
                                                         expirationDateString,
                                                         issuingAuthority);

            var attribute = new ProtoBuf.Attribute.Attribute
            {
                Name        = Constants.UserProfile.DocumentDetailsAttribute,
                ContentType = ContentType.String,
                Value       = ByteString.CopyFromUtf8(documentDetailsString)
            };

            _yotiProfile = TestTools.Profile.CreateUserProfileWithSingleAttribute <DocumentDetails>(attribute);

            DocumentDetails actualDocumentDetails = _yotiProfile.DocumentDetails.GetValue();

            Assert.AreEqual(issuingCountry, actualDocumentDetails.IssuingCountry);
            Assert.AreEqual(documentNumber, actualDocumentDetails.DocumentNumber);
            Assert.AreEqual(expirationDate, actualDocumentDetails.ExpirationDate);
            Assert.AreEqual(documentType, actualDocumentDetails.DocumentType);
            Assert.AreEqual(issuingAuthority, actualDocumentDetails.IssuingAuthority);
            Assert.AreEqual(documentDetailsString, actualDocumentDetails.ToString());
        }
Beispiel #2
0
        public void AddressShouldBeTakenFromFormattedAddressIfNull()
        {
            const string addressFormat    = "1";
            const string buildingNumber   = "15a";
            const string addressLineOne   = "15a North Street";
            const string townCity         = "CARSHALTON";
            const string postalCode       = "SM5 2HW";
            const string countryIso       = "GBR";
            const string country          = "UK";
            const string formattedAddress = "15a North Street\nCARSHALTON\nSM5 2HW\nUK";

            const string addressString =
                "{     \"" + AddressFormatJson + "\": " + addressFormat
                + ",     \"" + BuildingNumberJson + "\": \"" + buildingNumber
                + "\",     \"" + AddressLineOneJson + "\": \"" + addressLineOne
                + "\",     \"" + TownCityJson + "\": \"" + townCity
                + "\",     \"" + PostalCodeJson + "\": \"" + postalCode
                + "\",     \"" + CountryIsoJson + "\": \"" + countryIso
                + "\",     \"" + CountryJson + "\": \"" + country
                + "\",     \"" + FormattedAddressJson + "\": \"" + formattedAddress + "\" }";

            var attribute = new ProtoBuf.Attribute.Attribute
            {
                Name        = Constants.UserProfile.StructuredPostalAddressAttribute,
                ContentType = ContentType.Json,
                Value       = ByteString.CopyFromUtf8(addressString)
            };

            _yotiProfile = TestTools.Profile.CreateUserProfileWithSingleAttribute <Dictionary <string, JToken> >(attribute);

            ActivityDetailsParser.SetAddressToBeFormattedAddressIfNull(_yotiProfile);

            Assert.AreEqual(_yotiProfile.Address.GetValue(), formattedAddress);
        }
Beispiel #3
0
        public void ShouldRetrieveAttributeByID()
        {
            string attributeId1 = "9e2b479a-7be9-4e88-b4ab-e47fc930af61";
            string attributeId2 = "a8960bbb-de13-47d1-9bd3-f6f32de8505a";

            var attribute1 = CreateImageAttribute(Constants.UserProfile.SelfieAttribute, attributeId1);
            var attribute2 = CreateImageAttribute(Constants.UserProfile.SelfieAttribute, attributeId2);

            var selfieAttributes = new Dictionary <string, List <BaseAttribute> >
            {
                { "selfie", new List <BaseAttribute> {
                      attribute1, attribute2
                  } },
            };

            YotiProfile yotiProfile         = TestTools.Profile.CreateUserProfileWithAttributes <Image>(selfieAttributes);
            var         givenNamesattribute = new ProtoBuf.Attribute.Attribute
            {
                Name        = Constants.UserProfile.GivenNamesAttribute,
                ContentType = ContentType.String,
                Value       = ByteString.CopyFromUtf8("Alan")
            };

            TestTools.Profile.AddAttributeToProfile <string>(yotiProfile, givenNamesattribute);

            Assert.AreSame(attribute1, yotiProfile.GetAttributeById <Image>(attributeId1));
            Assert.AreSame(attribute2, yotiProfile.GetAttributeById <Image>(attributeId2));
        }
Beispiel #4
0
        public void NestedMultiValueShouldBeAddedToProfile()
        {
            var attributeName = "multiValueName";

            var nestedValue = new MultiValue.Types.Value
            {
                ContentType = ContentType.String,
                Data        = _byteStringValue
            };

            var multiValue = new MultiValue();

            multiValue.Values.Add(nestedValue);

            ProtoBuf.Attribute.Attribute attribute = TestTools.Attributes.CreateMultiValueAttribute(attributeName, ContentType.MultiValue, multiValue.ToByteString());

            _yotiProfile = TestTools.Profile.CreateUserProfileWithSingleAttribute <List <MultiValueItem> >(attribute);

            List <MultiValueItem> retrievedMultiValue = _yotiProfile.GetAttributeByName <List <MultiValueItem> >(attributeName).GetValue();

            MultiValueItem        outerMultiValue     = retrievedMultiValue.First();
            List <MultiValueItem> innerMultiValueList = (List <MultiValueItem>)outerMultiValue.Value;
            var innerMultiValue = innerMultiValueList.First();

            Assert.AreEqual(ContentType.String, innerMultiValue.ContentType);
            Assert.AreEqual(StringValue, innerMultiValue.Value);

            List <MultiValueItem> retrievedMultiValueFromCollection = _yotiProfile.GetAttributesByName <List <MultiValueItem> >(attributeName).Single().GetValue();
            MultiValueItem        outerMultiValueFromCollection     = retrievedMultiValueFromCollection.First();
            List <MultiValueItem> innerMultiValueListFromCollection = (List <MultiValueItem>)outerMultiValueFromCollection.Value;
            var innerMultiValueFromCollection = innerMultiValueListFromCollection.First();

            Assert.AreEqual(ContentType.String, innerMultiValueFromCollection.ContentType);
            Assert.AreEqual(StringValue, innerMultiValueFromCollection.Value);
        }
Beispiel #5
0
        public void ShouldAddThirdPartyAttributeToProfile()
        {
            var thirdPartyAttribute = TestTools.Attributes.CreateProtobufAttributeFromRawAnchor(TestData.TestAttributes.ThirdPartyAssignedAttribute);

            YotiProfile yotiProfile = TestTools.Profile.CreateUserProfileWithSingleAttribute <string>(thirdPartyAttribute);

            YotiAttribute <string> yotiAttribute = yotiProfile.GetAttributeByName <string>("com.thirdparty.id");

            Assert.AreEqual("test-third-party-attribute-0", yotiAttribute.GetValue());

            Assert.AreEqual("THIRD_PARTY", yotiAttribute.GetSources().First().GetValue());
            Assert.AreEqual("orgName", yotiAttribute.GetSources().First().GetSubType());

            Assert.AreEqual("THIRD_PARTY", yotiAttribute.GetVerifiers().First().GetValue());
            Assert.AreEqual("orgName", yotiAttribute.GetVerifiers().First().GetSubType());

            ReadOnlyCollection <YotiAttribute <string> > yotiAttributes = yotiProfile.GetAttributesByName <string>(name: "com.thirdparty.id");
            var yotiAttributeFromCollection = yotiAttributes.Single();

            Assert.AreEqual("test-third-party-attribute-0", yotiAttributeFromCollection.GetValue());

            Assert.AreEqual("THIRD_PARTY", yotiAttributeFromCollection.GetSources().First().GetValue());
            Assert.AreEqual("orgName", yotiAttributeFromCollection.GetSources().First().GetSubType());

            Assert.AreEqual("THIRD_PARTY", yotiAttributeFromCollection.GetVerifiers().First().GetValue());
            Assert.AreEqual("orgName", yotiAttributeFromCollection.GetVerifiers().First().GetSubType());
        }
Beispiel #6
0
 public void Startup()
 {
     _yotiProfile     = new YotiProfile();
     _yotiUserProfile = new YotiUserProfile();
     _activity        = new Activity(_yotiProfile, _yotiUserProfile);
     _attributeList   = new AttrpubapiV1.AttributeList();
 }
Beispiel #7
0
        public void IndiaStructuredPostalAddressShouldBeAddedToProfile()
        {
            const string rajguraNagar = "Rajguru Nagar";

            const string addressFormat    = "2";
            const string careOf           = "S/O: Name";
            const string building         = "House No.1111-A";
            const string street           = rajguraNagar;
            const string townCity         = rajguraNagar;
            const string subdistrict      = "Ludhiana";
            const string district         = "Ludhiana";
            const string state            = "Punjab";
            const string postalCode       = "141012";
            const string postOffice       = rajguraNagar;
            const string countryIso       = "IND";
            const string country          = "India";
            const string formattedAddress = "House No.1111-A\nRajgura Nagar\nLudhina\nPunjab\n141012\nIndia";

            const string addressString =
                "{     \"" + AddressFormatJson + "\": " + addressFormat
                + ",    \"" + CareOfJson + "\": \"" + careOf
                + "\",     \"" + BuildingJson + "\": \"" + building
                + "\",     \"" + StreetJson + "\": \"" + street
                + "\",     \"" + TownCityJson + "\": \"" + townCity
                + "\",     \"" + SubdistrictJson + "\": \"" + subdistrict
                + "\",     \"" + DistrictJson + "\":\"" + district
                + "\",     \"" + StateJson + "\": \"" + state
                + "\",     \"" + PostalCodeJson + "\": \"" + postalCode
                + "\",     \"" + PostOfficeJson + "\": \"" + postOffice
                + "\",     \"" + CountryIsoJson + "\": \"" + countryIso
                + "\",     \"" + CountryJson + "\": \"" + country
                + "\",     \"" + FormattedAddressJson + "\": \"" + formattedAddress + "\" }";

            var attribute = new ProtoBuf.Attribute.Attribute
            {
                Name        = Constants.UserProfile.StructuredPostalAddressAttribute,
                ContentType = ContentType.Json,
                Value       = ByteString.CopyFromUtf8(addressString)
            };

            _yotiProfile = TestTools.Profile.CreateUserProfileWithSingleAttribute <Dictionary <string, JToken> >(attribute);

            Dictionary <string, JToken> structuredPostalAddress = _yotiProfile.StructuredPostalAddress.GetValue();

            AssertDictionaryValue(addressFormat, AddressFormatJson, structuredPostalAddress);
            AssertDictionaryValue(careOf, CareOfJson, structuredPostalAddress);
            AssertDictionaryValue(building, BuildingJson, structuredPostalAddress);
            AssertDictionaryValue(street, StreetJson, structuredPostalAddress);
            AssertDictionaryValue(townCity, TownCityJson, structuredPostalAddress);
            AssertDictionaryValue(subdistrict, SubdistrictJson, structuredPostalAddress);
            AssertDictionaryValue(district, DistrictJson, structuredPostalAddress);
            AssertDictionaryValue(state, StateJson, structuredPostalAddress);
            AssertDictionaryValue(postalCode, PostalCodeJson, structuredPostalAddress);
            AssertDictionaryValue(postOffice, PostOfficeJson, structuredPostalAddress);
            AssertDictionaryValue(countryIso, CountryIsoJson, structuredPostalAddress);
            AssertDictionaryValue(country, CountryJson, structuredPostalAddress);
            AssertDictionaryValue(formattedAddress, FormattedAddressJson, structuredPostalAddress);
        }
Beispiel #8
0
        public void ShouldRetrievePhoneNumberAttribute()
        {
            YotiAttribute <string> initialAttribute = CreateStringAttribute(Constants.UserProfile.PhoneNumberAttribute);
            YotiProfile            yotiProfile      = TestTools.Profile.CreateUserProfileWithSingleAttribute(initialAttribute);

            YotiAttribute <string> mobileNumberAttribute = yotiProfile.MobileNumber;

            Assert.AreSame(initialAttribute, mobileNumberAttribute);
        }
Beispiel #9
0
        public void ShouldRetrieveFamilyNameAttribute()
        {
            YotiAttribute <string> initialAttribute = CreateStringAttribute(Constants.UserProfile.FamilyNameAttribute);
            YotiProfile            yotiProfile      = TestTools.Profile.CreateUserProfileWithSingleAttribute(initialAttribute);

            YotiAttribute <string> familyNameAttribute = yotiProfile.FamilyName;

            Assert.AreSame(initialAttribute, familyNameAttribute);
        }
Beispiel #10
0
        public void ShouldRetrieveGivenNamesAttribute()
        {
            YotiAttribute <string> initialAttribute = CreateStringAttribute(Constants.UserProfile.GivenNamesAttribute);
            YotiProfile            yotiProfile      = TestTools.Profile.CreateUserProfileWithSingleAttribute(initialAttribute);

            YotiAttribute <string> givenNamesAttribute = yotiProfile.GivenNames;

            Assert.AreSame(initialAttribute, givenNamesAttribute);
        }
Beispiel #11
0
        public void ShouldRetrieveEmailAddressAttribute()
        {
            YotiAttribute <string> initialAttribute = CreateStringAttribute(Constants.UserProfile.EmailAddressAttribute);
            YotiProfile            yotiProfile      = TestTools.Profile.CreateUserProfileWithSingleAttribute(initialAttribute);

            YotiAttribute <string> emailAddressAttribute = yotiProfile.EmailAddress;

            Assert.AreSame(initialAttribute, emailAddressAttribute);
        }
Beispiel #12
0
        public void ShouldRetrieveNationalityAttribute()
        {
            YotiAttribute <string> initialAttribute = CreateStringAttribute(Constants.UserProfile.NationalityAttribute);
            YotiProfile            yotiProfile      = TestTools.Profile.CreateUserProfileWithSingleAttribute(initialAttribute);

            YotiAttribute <string> nationalityAttribute = yotiProfile.Nationality;

            Assert.AreSame(initialAttribute, nationalityAttribute);
        }
Beispiel #13
0
        public void GetAttributeByIdReturnsNullWhenNotPresent()
        {
            var attribute = CreateImageAttribute(
                Constants.UserProfile.SelfieAttribute,
                "9e2b479a-7be9-4e88-b4ab-e47fc930af61");

            YotiProfile yotiProfile = TestTools.Profile.CreateUserProfileWithSingleAttribute(attribute);

            Assert.IsNull(yotiProfile.GetAttributeById <Image>("not-matching-id"));
        }
Beispiel #14
0
        public static YotiProfile AddAttributeToProfile <T>(YotiProfile yotiProfile, ProtoBuf.Attribute.Attribute attribute)
        {
            BaseAttribute parsedAttribute = AttributeConverter.ConvertToBaseAttribute(attribute);

            if (parsedAttribute != null)
            {
                yotiProfile.Add((YotiAttribute <T>)parsedAttribute);
            }

            return(yotiProfile);
        }
Beispiel #15
0
        public void DocumentImagesAttributeShouldBeAddedToProfile()
        {
            var multiValueProtobufAttribute = TestTools.Attributes.CreateProtobufAttributeFromRawAnchor(TestData.TestAttributes.MultiValueAttribute);

            _yotiProfile = TestTools.Profile.CreateUserProfileWithSingleAttribute <List <Image> >(multiValueProtobufAttribute);

            List <Image> actualDocumentImages = _yotiProfile.DocumentImages.GetValue();

            AssertImages.ContainsExpectedImage(actualDocumentImages, "image/jpeg", "38TVEH/9k=");
            AssertImages.ContainsExpectedImage(actualDocumentImages, "image/jpeg", "vWgD//2Q==");
        }
        public void FindAgeOverVerificationShouldReturnNullForNoMatch()
        {
            var mockBaseProfile = new Mock <IBaseProfile>();

            mockBaseProfile.Setup(
                x => x.FindAttributesStartingWith <string>(It.IsAny <string>()))
            .Returns(_emptyAttributeStringList);
            var yotiProfile = new YotiProfile(mockBaseProfile.Object);

            AgeVerification result = yotiProfile.FindAgeOverVerification(18);

            Assert.IsNull(result);
        }
Beispiel #17
0
        public void ShouldRetrieveSelfieAttribute()
        {
            var initialAttribute = new YotiAttribute <Image>(
                name: Constants.UserProfile.SelfieAttribute,
                value: new JpegImage(Encoding.UTF8.GetBytes(_value)),
                anchors: null);

            YotiProfile yotiProfile = TestTools.Profile.CreateUserProfileWithSingleAttribute(initialAttribute);

            YotiAttribute <Image> selfieAttribute = yotiProfile.Selfie;

            Assert.AreSame(initialAttribute, selfieAttribute);
        }
Beispiel #18
0
        public void ShouldRetrieveDateOfBirthAttribute()
        {
            var initialAttribute = new YotiAttribute <DateTime>(
                name: Constants.UserProfile.DateOfBirthAttribute,
                value: new DateTime(2000, 01, 13),
                anchors: null);

            YotiProfile yotiProfile = TestTools.Profile.CreateUserProfileWithSingleAttribute(initialAttribute);

            YotiAttribute <DateTime> dateOfBirthAttribute = yotiProfile.DateOfBirth;

            Assert.AreSame(initialAttribute, dateOfBirthAttribute);
        }
Beispiel #19
0
        public void UndefinedContentTypeShouldBeConvertedToString()
        {
            var attribute = new ProtoBuf.Attribute.Attribute
            {
                Name        = Constants.UserProfile.FamilyNameAttribute,
                ContentType = ContentType.Undefined,
                Value       = _byteStringValue
            };

            _yotiProfile = TestTools.Profile.CreateUserProfileWithSingleAttribute <string>(attribute);

            Assert.AreEqual(StringValue, _yotiProfile.FamilyName.GetValue());
        }
Beispiel #20
0
        public void FullNameShouldBeAddedToProfile()
        {
            var attribute = new ProtoBuf.Attribute.Attribute
            {
                Name        = Constants.UserProfile.FullNameAttribute,
                ContentType = ContentType.String,
                Value       = _byteStringValue
            };

            _yotiProfile = TestTools.Profile.CreateUserProfileWithSingleAttribute <string>(attribute);

            Assert.AreEqual(_yotiProfile.FullName.GetValue(), StringValue);
        }
Beispiel #21
0
        public void DateOfBirthShouldBeAddedToProfile()
        {
            var attribute = new ProtoBuf.Attribute.Attribute
            {
                Name        = Constants.UserProfile.DateOfBirthAttribute,
                ContentType = ContentType.Date,
                Value       = ByteString.CopyFromUtf8(DateOfBirthString)
            };

            _yotiProfile = TestTools.Profile.CreateUserProfileWithSingleAttribute <DateTime>(attribute);

            Assert.IsInstanceOfType(_yotiProfile.DateOfBirth.GetValue(), typeof(DateTime));
            Assert.AreEqual(_yotiProfile.DateOfBirth.GetValue(), DateOfBirthValue);
        }
        public void GetAttributeByNameShouldRetrieveDatetime()
        {
            DateTime value            = new DateTime(1990, 1, 13);
            var      initialAttribute = new YotiAttribute <DateTime>(
                name: Constants.UserProfile.DateOfBirthAttribute,
                value: value,
                anchors: null);

            YotiProfile userProfile = TestTools.Profile.CreateUserProfileWithSingleAttribute(initialAttribute);

            YotiAttribute <DateTime> dobAttribute = userProfile.GetAttributeByName <DateTime>(Constants.UserProfile.DateOfBirthAttribute);

            Assert.AreSame(initialAttribute, dobAttribute);
            Assert.AreEqual(value, dobAttribute.GetValue());
        }
        public void GetAttributeByNameShouldRetrieveString()
        {
            var initialAttribute = new YotiAttribute <string>(
                name: Constants.UserProfile.NationalityAttribute,
                value: "Nation",
                anchors: null);

            YotiProfile userProfile = new YotiProfile();

            userProfile.Add(initialAttribute);

            YotiAttribute <string> nationalityAttribute = userProfile.GetAttributeByName <string>(Constants.UserProfile.NationalityAttribute);

            Assert.AreSame(initialAttribute, nationalityAttribute);
        }
Beispiel #24
0
        public void NewContentTypeShouldBeRetrieved()
        {
            string name      = "newType";
            var    attribute = new ProtoBuf.Attribute.Attribute
            {
                Name        = name,
                ContentType = (ContentType)99,
                Value       = _byteStringValue
            };

            _yotiProfile = TestTools.Profile.CreateUserProfileWithSingleAttribute <string>(attribute);

            Assert.AreEqual(StringValue, _yotiProfile.GetAttributeByName <string>(name).GetValue().ToString());
            Assert.AreEqual(StringValue, _yotiProfile.GetAttributesByName <string>(name).Single().GetValue().ToString());
        }
Beispiel #25
0
        public void DrivingLicenseShouldBeAddedToAttribute()
        {
            ProtoBuf.Attribute.Attribute attribute = TestTools.Anchors.BuildAnchoredAttribute(
                Constants.UserProfile.StructuredPostalAddressAttribute,
                "{ \"properties\": { \"name\": { \"type\": \"string\"} } }",
                ProtoBuf.Attribute.ContentType.Json,
                TestAnchors.DrivingLicenseAnchor);

            _yotiProfile = TestTools.Profile.AddAttributeToProfile <Dictionary <string, JToken> >(new YotiProfile(), attribute);

            IEnumerable <Anchor> sources = _yotiProfile.StructuredPostalAddress.GetSources();

            Assert.IsTrue(
                sources.Any(
                    s => s.GetValue() == DrivingLicenseSourceType));
        }
Beispiel #26
0
        public void ShouldRetrieveIntAttribute()
        {
            string intAttributeName = "intAttributeName";
            int    intValue         = 92387;
            var    initialAttribute = new YotiAttribute <int>(
                intAttributeName,
                intValue,
                anchors: null);

            YotiProfile         yotiProfile  = TestTools.Profile.CreateUserProfileWithSingleAttribute(initialAttribute);
            YotiAttribute <int> intAttribute = yotiProfile.GetAttributeByName <int>(intAttributeName);
            YotiAttribute <int> intAttributeFromCollection = yotiProfile.GetAttributesByName <int>(intAttributeName).Single();

            Assert.AreEqual(intValue, intAttribute.GetValue());
            Assert.AreEqual(intValue, intAttributeFromCollection.GetValue());
        }
Beispiel #27
0
        public void PassportShouldBeAddedToAttribute()
        {
            ProtoBuf.Attribute.Attribute attribute = TestTools.Anchors.BuildAnchoredAttribute(
                Constants.UserProfile.DateOfBirthAttribute,
                DateOfBirthString,
                ProtoBuf.Attribute.ContentType.Date,
                TestAnchors.PassportAnchor);

            _yotiProfile = TestTools.Profile.AddAttributeToProfile <DateTime>(new YotiProfile(), attribute);

            IEnumerable <Anchor> sources = _yotiProfile.DateOfBirth.GetSources();

            Assert.IsTrue(
                sources.Any(
                    s => s.GetValue() == PassportSourceType));
        }
Beispiel #28
0
        public void YotiAdminShouldBeAddedToAttribute()
        {
            ProtoBuf.Attribute.Attribute attribute = TestTools.Anchors.BuildAnchoredAttribute(
                Constants.UserProfile.SelfieAttribute,
                StringValue,
                ProtoBuf.Attribute.ContentType.Jpeg,
                TestAnchors.YotiAdminAnchor);

            _yotiProfile = TestTools.Profile.AddAttributeToProfile <Image>(new YotiProfile(), attribute);

            IEnumerable <Anchor> verifiers = _yotiProfile.Selfie.GetVerifiers();

            Assert.IsTrue(
                verifiers.Any(
                    s => s.GetValue() == YotiAdminVerifierType));
        }
Beispiel #29
0
        public void ShouldRetrieveStructuredPostalAddressAttribute()
        {
            var jsonValue = Newtonsoft.Json.JsonConvert.DeserializeObject <Dictionary <string, JToken> >(
                "{ \"properties\": { \"name\": { \"type\": \"string\" } } }");

            var initialAttribute = new YotiAttribute <Dictionary <string, JToken> >(
                name: Constants.UserProfile.StructuredPostalAddressAttribute,
                value: jsonValue,
                anchors: null);

            YotiProfile yotiProfile = TestTools.Profile.CreateUserProfileWithSingleAttribute(initialAttribute);

            YotiAttribute <Dictionary <string, JToken> > structuredPostalAddressAttribute = yotiProfile.StructuredPostalAddress;

            Assert.AreSame(initialAttribute, structuredPostalAddressAttribute);
        }
Beispiel #30
0
        public void JpegSelfieShouldBeAddedToProfile()
        {
            var attribute = new ProtoBuf.Attribute.Attribute
            {
                Name        = Constants.UserProfile.SelfieAttribute,
                ContentType = ContentType.Jpeg,
                Value       = _byteStringValue
            };

            _yotiProfile = TestTools.Profile.CreateUserProfileWithSingleAttribute <Image>(attribute);

            Assert.AreEqual("image/jpeg", _yotiProfile.Selfie.GetValue().GetMIMEType());
            Assert.AreEqual(
                "data:image/jpeg;base64," + Conversion.BytesToBase64(Encoding.UTF8.GetBytes(StringValue)),
                _yotiProfile.Selfie.GetValue().GetBase64URI());
            Assert.IsNotNull(_yotiProfile.Selfie.GetValue());
        }