FPRSessionDetailsTest.m 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. // Copyright 2020 Google LLC
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. #import <XCTest/XCTest.h>
  15. #import "FirebasePerformance/Sources/AppActivity/FPRSessionDetails.h"
  16. @interface FPRSessionDetailsTest : XCTestCase
  17. @end
  18. @implementation FPRSessionDetailsTest
  19. /** Validates that an instance gets created. */
  20. - (void)testInstanceCreation {
  21. FPRSessionDetails *details = [[FPRSessionDetails alloc] initWithSessionId:@"random"
  22. options:FPRSessionOptionsNone];
  23. XCTAssertNotNil(details);
  24. }
  25. /** Validated that the details are valid. */
  26. - (void)testDetailsData {
  27. FPRSessionDetails *details = [[FPRSessionDetails alloc] initWithSessionId:@"random"
  28. options:FPRSessionOptionsNone];
  29. XCTAssertEqual(details.sessionId, @"random");
  30. XCTAssertEqual(details.options, FPRSessionOptionsNone);
  31. XCTAssertEqual(details.sessionLengthInMinutes, 0);
  32. }
  33. /** Validates that the session details equality with another object. */
  34. - (void)testSessionDetailsEquality {
  35. FPRSessionDetails *details1 = [[FPRSessionDetails alloc] initWithSessionId:@"random"
  36. options:FPRSessionOptionsNone];
  37. FPRSessionDetails *details2 = [[FPRSessionDetails alloc] initWithSessionId:@"random"
  38. options:FPRSessionOptionsNone];
  39. XCTAssertEqualObjects(details1, details2);
  40. FPRSessionDetails *details3 =
  41. [[FPRSessionDetails alloc] initWithSessionId:@"random" options:FPRSessionOptionsEvents];
  42. XCTAssertEqualObjects(details1, details3);
  43. }
  44. @end