func testEncoding()

in FBSDKCoreKit/FBSDKCoreKitTests/ProfileTests.swift [897:982]


  func testEncoding() {
    let coder = TestCoder()
    let profile = SampleUserProfiles.validLimited
    profile.encode(with: coder)

    XCTAssertEqual(
      coder.encodedObject["userID"] as? String,
      profile.userID,
      "Should encode the expected user identifier"
    )
    XCTAssertEqual(
      coder.encodedObject["firstName"] as? String,
      profile.firstName,
      "Should encode the expected first name"
    )
    XCTAssertEqual(
      coder.encodedObject["middleName"] as? String,
      profile.middleName,
      "Should encode the expected middle name"
    )
    XCTAssertEqual(
      coder.encodedObject["lastName"] as? String,
      profile.lastName,
      "Should encode the expected last name"
    )
    XCTAssertEqual(
      coder.encodedObject["name"] as? String,
      profile.name,
      "Should encode the expected name"
    )
    XCTAssertEqual(
      coder.encodedObject["linkURL"] as? URL,
      profile.linkURL,
      "Should encode the expected link URL"
    )
    XCTAssertEqual(
      coder.encodedObject["refreshDate"] as? Date,
      profile.refreshDate,
      "Should encode the expected refresh date"
    )
    XCTAssertEqual(
      coder.encodedObject["imageURL"] as? URL,
      profile.imageURL,
      "Should encode the expected image URL"
    )
    XCTAssertEqual(
      coder.encodedObject["email"] as? String,
      profile.email,
      "Should encode the expected email address"
    )
    XCTAssertEqual(
      coder.encodedObject["friendIDs"] as? [String],
      profile.friendIDs,
      "Should encode the expected list of friend identifiers"
    )
    XCTAssertEqual(
      coder.encodedObject["birthday"] as? Date,
      profile.birthday,
      "Should encode the expected user birthday"
    )
    XCTAssertEqual(
      coder.encodedObject["ageRange"] as? UserAgeRange,
      profile.ageRange,
      "Should encode the expected user age range"
    )
    XCTAssertEqual(
      coder.encodedObject["hometown"] as? Location,
      profile.hometown,
      "Should encode the expected user hometown"
    )
    XCTAssertEqual(
      coder.encodedObject["location"] as? Location,
      profile.location,
      "Should encode the expected user location"
    )
    XCTAssertEqual(
      coder.encodedObject["gender"] as? String,
      profile.gender,
      "Should encode the expected user gender"
    )
    XCTAssertEqual(
      coder.encodedObject["isLimited"] as? Bool,
      true,
      "isLimited should be true"
    )
  }