generated tests
This commit is contained in:
Родитель
2e2b84bf75
Коммит
04f819142c
|
@ -49,3 +49,6 @@ function RegExReplace([string]$fileName, [string]$regex, [string]$replacement=""
|
|||
|
||||
# Generate public schema using bond generator
|
||||
& "$generatorPath\BondSchemaGenerator.exe" -v -i "$schemasPath\AvailabilityData.bond" -i "$schemasPath\Base.bond" -i "$schemasPath\ContextTagKeys.bond" -i "$schemasPath\Data.bond" -i "$schemasPath\DataPoint.bond" -i "$schemasPath\DataPointType.bond" -i "$schemasPath\Domain.bond" -i "$schemasPath\Envelope.bond" -i "$schemasPath\EventData.bond" -i "$schemasPath\ExceptionData.bond" -i "$schemasPath\ExceptionDetails.bond" -i "$schemasPath\MessageData.bond" -i "$schemasPath\MetricData.bond" -i "$schemasPath\PageViewData.bond" -i "$schemasPath\PageViewPerfData.bond" -i "$schemasPath\RemoteDependencyData.bond" -i "$schemasPath\RequestData.bond" -i "$schemasPath\SeverityLevel.bond" -i "$schemasPath\StackFrame.bond" -o "$currentDir\..\" -e RubyProductLanguage -t RubyProductLayout
|
||||
|
||||
# Generate public schema using bond generator
|
||||
& "$generatorPath\BondSchemaGenerator.exe" -v -i "$schemasPath\AvailabilityData.bond" -i "$schemasPath\Base.bond" -i "$schemasPath\ContextTagKeys.bond" -i "$schemasPath\Data.bond" -i "$schemasPath\DataPoint.bond" -i "$schemasPath\DataPointType.bond" -i "$schemasPath\Domain.bond" -i "$schemasPath\Envelope.bond" -i "$schemasPath\EventData.bond" -i "$schemasPath\ExceptionData.bond" -i "$schemasPath\ExceptionDetails.bond" -i "$schemasPath\MessageData.bond" -i "$schemasPath\MetricData.bond" -i "$schemasPath\PageViewData.bond" -i "$schemasPath\PageViewPerfData.bond" -i "$schemasPath\RemoteDependencyData.bond" -i "$schemasPath\RequestData.bond" -i "$schemasPath\SeverityLevel.bond" -i "$schemasPath\StackFrame.bond" -o "$currentDir\..\" -e RubyTestLanguage -t RubyTestLayout
|
||||
|
|
|
@ -10,35 +10,22 @@ class TestApplication < Test::Unit::TestCase
|
|||
end
|
||||
|
||||
def test_ver_works_as_expected
|
||||
expected = 'Test string'
|
||||
expected = 'GLvyAJsZ'
|
||||
item = Contracts::Application.new
|
||||
item.ver = expected
|
||||
actual = item.ver
|
||||
assert_equal expected, actual
|
||||
expected = 'Other string'
|
||||
expected = 'eMtJfeXF'
|
||||
item.ver = expected
|
||||
actual = item.ver
|
||||
assert_equal expected, actual
|
||||
end
|
||||
|
||||
def test_build_works_as_expected
|
||||
expected = 'Test string'
|
||||
item = Contracts::Application.new
|
||||
item.build = expected
|
||||
actual = item.build
|
||||
assert_equal expected, actual
|
||||
expected = 'Other string'
|
||||
item.build = expected
|
||||
actual = item.build
|
||||
assert_equal expected, actual
|
||||
end
|
||||
|
||||
def test_to_json_works_as_expected
|
||||
item = Contracts::Application.new
|
||||
item.ver = 'Test string'
|
||||
item.build = 'Test string'
|
||||
item.ver = 'GLvyAJsZ'
|
||||
actual = item.to_json
|
||||
expected = '{"ai.application.ver":"Test string","ai.application.build":"Test string"}'
|
||||
expected = '{"ai.application.ver":"GLvyAJsZ"}'
|
||||
assert_equal expected, actual
|
||||
end
|
||||
end
|
||||
|
|
|
@ -0,0 +1,127 @@
|
|||
require_relative '../../../../lib/application_insights/channel/contracts/availability_data'
|
||||
require 'test/unit'
|
||||
|
||||
include ApplicationInsights::Channel
|
||||
|
||||
class TestAvailabilityData < Test::Unit::TestCase
|
||||
def test_initialize
|
||||
item = Contracts::AvailabilityData.new
|
||||
assert_not_nil item
|
||||
end
|
||||
|
||||
def test_ver_works_as_expected
|
||||
expected = 60
|
||||
item = Contracts::AvailabilityData.new
|
||||
item.ver = expected
|
||||
actual = item.ver
|
||||
assert_equal expected, actual
|
||||
expected = 31
|
||||
item.ver = expected
|
||||
actual = item.ver
|
||||
assert_equal expected, actual
|
||||
end
|
||||
|
||||
def test_id_works_as_expected
|
||||
expected = 'RpFcQvQE'
|
||||
item = Contracts::AvailabilityData.new
|
||||
item.id = expected
|
||||
actual = item.id
|
||||
assert_equal expected, actual
|
||||
expected = 'cxoRhoau'
|
||||
item.id = expected
|
||||
actual = item.id
|
||||
assert_equal expected, actual
|
||||
end
|
||||
|
||||
def test_name_works_as_expected
|
||||
expected = 'zQBYaqQb'
|
||||
item = Contracts::AvailabilityData.new
|
||||
item.name = expected
|
||||
actual = item.name
|
||||
assert_equal expected, actual
|
||||
expected = 'uHoMIRvK'
|
||||
item.name = expected
|
||||
actual = item.name
|
||||
assert_equal expected, actual
|
||||
end
|
||||
|
||||
def test_duration_works_as_expected
|
||||
expected = 'NyxpMJyX'
|
||||
item = Contracts::AvailabilityData.new
|
||||
item.duration = expected
|
||||
actual = item.duration
|
||||
assert_equal expected, actual
|
||||
expected = 'pJxuCsyu'
|
||||
item.duration = expected
|
||||
actual = item.duration
|
||||
assert_equal expected, actual
|
||||
end
|
||||
|
||||
def test_success_works_as_expected
|
||||
expected = TRUE
|
||||
item = Contracts::AvailabilityData.new
|
||||
item.success = expected
|
||||
actual = item.success
|
||||
assert_equal expected, actual
|
||||
expected = FALSE
|
||||
item.success = expected
|
||||
actual = item.success
|
||||
assert_equal expected, actual
|
||||
end
|
||||
|
||||
def test_run_location_works_as_expected
|
||||
expected = 'KUVHiBWZ'
|
||||
item = Contracts::AvailabilityData.new
|
||||
item.run_location = expected
|
||||
actual = item.run_location
|
||||
assert_equal expected, actual
|
||||
expected = 'XXgBHdTA'
|
||||
item.run_location = expected
|
||||
actual = item.run_location
|
||||
assert_equal expected, actual
|
||||
end
|
||||
|
||||
def test_message_works_as_expected
|
||||
expected = 'igFdqfxl'
|
||||
item = Contracts::AvailabilityData.new
|
||||
item.message = expected
|
||||
actual = item.message
|
||||
assert_equal expected, actual
|
||||
expected = 'KFGmgAzg'
|
||||
item.message = expected
|
||||
actual = item.message
|
||||
assert_equal expected, actual
|
||||
end
|
||||
|
||||
def test_properties_works_as_expected
|
||||
item = Contracts::AvailabilityData.new
|
||||
actual = item.properties
|
||||
assert_not_nil actual
|
||||
end
|
||||
|
||||
def test_measurements_works_as_expected
|
||||
item = Contracts::AvailabilityData.new
|
||||
actual = item.measurements
|
||||
assert_not_nil actual
|
||||
end
|
||||
|
||||
def test_to_json_works_as_expected
|
||||
item = Contracts::AvailabilityData.new
|
||||
item.ver = 60
|
||||
item.id = 'RpFcQvQE'
|
||||
item.name = 'zQBYaqQb'
|
||||
item.duration = 'NyxpMJyX'
|
||||
item.success = TRUE
|
||||
item.run_location = 'KUVHiBWZ'
|
||||
item.message = 'igFdqfxl'
|
||||
{ 'GtPP' => 'RNyTculM' }.each do |key, value|
|
||||
item.properties[key] = value
|
||||
end
|
||||
{ 'IzDw' => 2.4493 }.each do |key, value|
|
||||
item.measurements[key] = value
|
||||
end
|
||||
actual = item.to_json
|
||||
expected = '{"ver":60,"id":"RpFcQvQE","name":"zQBYaqQb","duration":"NyxpMJyX","success":true,"runLocation":"KUVHiBWZ","message":"igFdqfxl","properties":{"GtPP":"RNyTculM"},"measurements":{"IzDw":2.4493}}'
|
||||
assert_equal expected, actual
|
||||
end
|
||||
end
|
|
@ -0,0 +1,31 @@
|
|||
require_relative '../../../../lib/application_insights/channel/contracts/base'
|
||||
require 'test/unit'
|
||||
|
||||
include ApplicationInsights::Channel
|
||||
|
||||
class TestBase < Test::Unit::TestCase
|
||||
def test_initialize
|
||||
item = Contracts::Base.new
|
||||
assert_not_nil item
|
||||
end
|
||||
|
||||
def test_base_type_works_as_expected
|
||||
expected = 'DkiuYcvD'
|
||||
item = Contracts::Base.new
|
||||
item.base_type = expected
|
||||
actual = item.base_type
|
||||
assert_equal expected, actual
|
||||
expected = 'cMlRgUYh'
|
||||
item.base_type = expected
|
||||
actual = item.base_type
|
||||
assert_equal expected, actual
|
||||
end
|
||||
|
||||
def test_to_json_works_as_expected
|
||||
item = Contracts::Base.new
|
||||
item.base_type = 'DkiuYcvD'
|
||||
actual = item.to_json
|
||||
expected = '{"baseType":"DkiuYcvD"}'
|
||||
assert_equal expected, actual
|
||||
end
|
||||
end
|
|
@ -9,25 +9,25 @@ class TestCloud < Test::Unit::TestCase
|
|||
assert_not_nil item
|
||||
end
|
||||
|
||||
def test_role_name_works_as_expected
|
||||
expected = 'Test string'
|
||||
def test_role_works_as_expected
|
||||
expected = 'xVvRTelh'
|
||||
item = Contracts::Cloud.new
|
||||
item.role_name = expected
|
||||
actual = item.role_name
|
||||
item.role = expected
|
||||
actual = item.role
|
||||
assert_equal expected, actual
|
||||
expected = 'Other string'
|
||||
item.role_name = expected
|
||||
actual = item.role_name
|
||||
expected = 'ftVmPRMR'
|
||||
item.role = expected
|
||||
actual = item.role
|
||||
assert_equal expected, actual
|
||||
end
|
||||
|
||||
def test_role_instance_works_as_expected
|
||||
expected = 'Test string'
|
||||
expected = 'ouUssqtY'
|
||||
item = Contracts::Cloud.new
|
||||
item.role_instance = expected
|
||||
actual = item.role_instance
|
||||
assert_equal expected, actual
|
||||
expected = 'Other string'
|
||||
expected = 'zeXpdMOC'
|
||||
item.role_instance = expected
|
||||
actual = item.role_instance
|
||||
assert_equal expected, actual
|
||||
|
@ -35,10 +35,10 @@ class TestCloud < Test::Unit::TestCase
|
|||
|
||||
def test_to_json_works_as_expected
|
||||
item = Contracts::Cloud.new
|
||||
item.role_name = 'Role name'
|
||||
item.role_instance = 'Role instance'
|
||||
item.role = 'xVvRTelh'
|
||||
item.role_instance = 'ouUssqtY'
|
||||
actual = item.to_json
|
||||
expected = '{"ai.cloud.role":"Role name","ai.cloud.roleInstance":"Role instance"}'
|
||||
expected = '{"ai.cloud.role":"xVvRTelh","ai.cloud.roleInstance":"ouUssqtY"}'
|
||||
assert_equal expected, actual
|
||||
end
|
||||
end
|
||||
|
|
|
@ -10,12 +10,12 @@ class TestData < Test::Unit::TestCase
|
|||
end
|
||||
|
||||
def test_base_type_works_as_expected
|
||||
expected = 'Test string'
|
||||
expected = 'DkiuYcvD'
|
||||
item = Contracts::Data.new
|
||||
item.base_type = expected
|
||||
actual = item.base_type
|
||||
assert_equal expected, actual
|
||||
expected = 'Other string'
|
||||
expected = 'cMlRgUYh'
|
||||
item.base_type = expected
|
||||
actual = item.base_type
|
||||
assert_equal expected, actual
|
||||
|
@ -35,10 +35,11 @@ class TestData < Test::Unit::TestCase
|
|||
|
||||
def test_to_json_works_as_expected
|
||||
item = Contracts::Data.new
|
||||
item.base_type = 'Test string'
|
||||
item.base_type = 'DkiuYcvD'
|
||||
item.base_type = 'DkiuYcvD'
|
||||
item.base_data = { 'key' => 'value' }
|
||||
actual = item.to_json
|
||||
expected = '{"baseType":"Test string","baseData":{"key":"value"}}'
|
||||
expected = '{"baseType":"DkiuYcvD","baseData":{"key":"value"}}'
|
||||
assert_equal expected, actual
|
||||
end
|
||||
end
|
||||
|
|
|
@ -9,85 +9,97 @@ class TestDataPoint < Test::Unit::TestCase
|
|||
assert_not_nil item
|
||||
end
|
||||
|
||||
def test_ns_works_as_expected
|
||||
expected = 'jDBZQtSX'
|
||||
item = Contracts::DataPoint.new
|
||||
item.ns = expected
|
||||
actual = item.ns
|
||||
assert_equal expected, actual
|
||||
expected = 'FrKumsuy'
|
||||
item.ns = expected
|
||||
actual = item.ns
|
||||
assert_equal expected, actual
|
||||
end
|
||||
|
||||
def test_name_works_as_expected
|
||||
expected = 'Test string'
|
||||
expected = 'ILuHEzWe'
|
||||
item = Contracts::DataPoint.new
|
||||
item.name = expected
|
||||
actual = item.name
|
||||
assert_equal expected, actual
|
||||
expected = 'Other string'
|
||||
expected = 'DamjApTx'
|
||||
item.name = expected
|
||||
actual = item.name
|
||||
assert_equal expected, actual
|
||||
end
|
||||
|
||||
def test_kind_works_as_expected
|
||||
expected = 5
|
||||
expected = 89
|
||||
item = Contracts::DataPoint.new
|
||||
item.kind = expected
|
||||
actual = item.kind
|
||||
assert_equal expected, actual
|
||||
expected = 3
|
||||
expected = 69
|
||||
item.kind = expected
|
||||
actual = item.kind
|
||||
assert_equal expected, actual
|
||||
end
|
||||
|
||||
def test_value_works_as_expected
|
||||
expected = 1.5
|
||||
expected = 0.6264
|
||||
item = Contracts::DataPoint.new
|
||||
item.value = expected
|
||||
actual = item.value
|
||||
assert_equal expected, actual
|
||||
expected = 4.8
|
||||
expected = 1.322
|
||||
item.value = expected
|
||||
actual = item.value
|
||||
assert_equal expected, actual
|
||||
end
|
||||
|
||||
def test_count_works_as_expected
|
||||
expected = 42
|
||||
expected = 92
|
||||
item = Contracts::DataPoint.new
|
||||
item.count = expected
|
||||
actual = item.count
|
||||
assert_equal expected, actual
|
||||
expected = 13
|
||||
expected = 10
|
||||
item.count = expected
|
||||
actual = item.count
|
||||
assert_equal expected, actual
|
||||
end
|
||||
|
||||
def test_min_works_as_expected
|
||||
expected = 1.5
|
||||
expected = 0.597
|
||||
item = Contracts::DataPoint.new
|
||||
item.min = expected
|
||||
actual = item.min
|
||||
assert_equal expected, actual
|
||||
expected = 4.8
|
||||
expected = 3.8705
|
||||
item.min = expected
|
||||
actual = item.min
|
||||
assert_equal expected, actual
|
||||
end
|
||||
|
||||
def test_max_works_as_expected
|
||||
expected = 1.5
|
||||
expected = 3.0309
|
||||
item = Contracts::DataPoint.new
|
||||
item.max = expected
|
||||
actual = item.max
|
||||
assert_equal expected, actual
|
||||
expected = 4.8
|
||||
expected = 4.215
|
||||
item.max = expected
|
||||
actual = item.max
|
||||
assert_equal expected, actual
|
||||
end
|
||||
|
||||
def test_std_dev_works_as_expected
|
||||
expected = 1.5
|
||||
expected = 8.2776
|
||||
item = Contracts::DataPoint.new
|
||||
item.std_dev = expected
|
||||
actual = item.std_dev
|
||||
assert_equal expected, actual
|
||||
expected = 4.8
|
||||
expected = 4.9077
|
||||
item.std_dev = expected
|
||||
actual = item.std_dev
|
||||
assert_equal expected, actual
|
||||
|
@ -95,15 +107,16 @@ class TestDataPoint < Test::Unit::TestCase
|
|||
|
||||
def test_to_json_works_as_expected
|
||||
item = Contracts::DataPoint.new
|
||||
item.name = 'Test string'
|
||||
item.kind = 5
|
||||
item.value = 1.5
|
||||
item.count = 42
|
||||
item.min = 1.5
|
||||
item.max = 1.5
|
||||
item.std_dev = 1.5
|
||||
item.ns = 'jDBZQtSX'
|
||||
item.name = 'ILuHEzWe'
|
||||
item.kind = 89
|
||||
item.value = 0.6264
|
||||
item.count = 92
|
||||
item.min = 0.597
|
||||
item.max = 3.0309
|
||||
item.std_dev = 8.2776
|
||||
actual = item.to_json
|
||||
expected = '{"name":"Test string","kind":5,"value":1.5,"count":42,"min":1.5,"max":1.5,"stdDev":1.5}'
|
||||
expected = '{"ns":"jDBZQtSX","name":"ILuHEzWe","kind":89,"value":0.6264,"count":92,"min":0.597,"max":3.0309,"stdDev":8.2776}'
|
||||
assert_equal expected, actual
|
||||
end
|
||||
end
|
||||
|
|
|
@ -10,191 +10,87 @@ class TestDevice < Test::Unit::TestCase
|
|||
end
|
||||
|
||||
def test_id_works_as_expected
|
||||
expected = 'Test string'
|
||||
expected = 'ELCIfeDG'
|
||||
item = Contracts::Device.new
|
||||
item.id = expected
|
||||
actual = item.id
|
||||
assert_equal expected, actual
|
||||
expected = 'Other string'
|
||||
expected = 'cOztzrST'
|
||||
item.id = expected
|
||||
actual = item.id
|
||||
assert_equal expected, actual
|
||||
end
|
||||
|
||||
def test_ip_works_as_expected
|
||||
expected = 'Test string'
|
||||
item = Contracts::Device.new
|
||||
item.ip = expected
|
||||
actual = item.ip
|
||||
assert_equal expected, actual
|
||||
expected = 'Other string'
|
||||
item.ip = expected
|
||||
actual = item.ip
|
||||
assert_equal expected, actual
|
||||
end
|
||||
|
||||
def test_language_works_as_expected
|
||||
expected = 'Test string'
|
||||
item = Contracts::Device.new
|
||||
item.language = expected
|
||||
actual = item.language
|
||||
assert_equal expected, actual
|
||||
expected = 'Other string'
|
||||
item.language = expected
|
||||
actual = item.language
|
||||
assert_equal expected, actual
|
||||
end
|
||||
|
||||
def test_locale_works_as_expected
|
||||
expected = 'Test string'
|
||||
expected = 'aXkpqBWw'
|
||||
item = Contracts::Device.new
|
||||
item.locale = expected
|
||||
actual = item.locale
|
||||
assert_equal expected, actual
|
||||
expected = 'Other string'
|
||||
expected = 'CiVQEdxZ'
|
||||
item.locale = expected
|
||||
actual = item.locale
|
||||
assert_equal expected, actual
|
||||
end
|
||||
|
||||
def test_model_works_as_expected
|
||||
expected = 'Test string'
|
||||
expected = 'mkBCkkHm'
|
||||
item = Contracts::Device.new
|
||||
item.model = expected
|
||||
actual = item.model
|
||||
assert_equal expected, actual
|
||||
expected = 'Other string'
|
||||
expected = 'DxVrFmpS'
|
||||
item.model = expected
|
||||
actual = item.model
|
||||
assert_equal expected, actual
|
||||
end
|
||||
|
||||
def test_network_works_as_expected
|
||||
expected = 'Test string'
|
||||
item = Contracts::Device.new
|
||||
item.network = expected
|
||||
actual = item.network
|
||||
assert_equal expected, actual
|
||||
expected = 'Other string'
|
||||
item.network = expected
|
||||
actual = item.network
|
||||
assert_equal expected, actual
|
||||
end
|
||||
|
||||
def test_oem_name_works_as_expected
|
||||
expected = 'Test string'
|
||||
expected = 'EazNnals'
|
||||
item = Contracts::Device.new
|
||||
item.oem_name = expected
|
||||
actual = item.oem_name
|
||||
assert_equal expected, actual
|
||||
expected = 'Other string'
|
||||
expected = 'cvKMXLfr'
|
||||
item.oem_name = expected
|
||||
actual = item.oem_name
|
||||
assert_equal expected, actual
|
||||
end
|
||||
|
||||
def test_os_works_as_expected
|
||||
expected = 'Test string'
|
||||
item = Contracts::Device.new
|
||||
item.os = expected
|
||||
actual = item.os
|
||||
assert_equal expected, actual
|
||||
expected = 'Other string'
|
||||
item.os = expected
|
||||
actual = item.os
|
||||
assert_equal expected, actual
|
||||
end
|
||||
|
||||
def test_os_version_works_as_expected
|
||||
expected = 'Test string'
|
||||
expected = 'cQgvEEEr'
|
||||
item = Contracts::Device.new
|
||||
item.os_version = expected
|
||||
actual = item.os_version
|
||||
assert_equal expected, actual
|
||||
expected = 'Other string'
|
||||
expected = 'EETihAgX'
|
||||
item.os_version = expected
|
||||
actual = item.os_version
|
||||
assert_equal expected, actual
|
||||
end
|
||||
|
||||
def test_role_instance_works_as_expected
|
||||
expected = 'Test string'
|
||||
item = Contracts::Device.new
|
||||
item.role_instance = expected
|
||||
actual = item.role_instance
|
||||
assert_equal expected, actual
|
||||
expected = 'Other string'
|
||||
item.role_instance = expected
|
||||
actual = item.role_instance
|
||||
assert_equal expected, actual
|
||||
end
|
||||
|
||||
def test_role_name_works_as_expected
|
||||
expected = 'Test string'
|
||||
item = Contracts::Device.new
|
||||
item.role_name = expected
|
||||
actual = item.role_name
|
||||
assert_equal expected, actual
|
||||
expected = 'Other string'
|
||||
item.role_name = expected
|
||||
actual = item.role_name
|
||||
assert_equal expected, actual
|
||||
end
|
||||
|
||||
def test_screen_resolution_works_as_expected
|
||||
expected = 'Test string'
|
||||
item = Contracts::Device.new
|
||||
item.screen_resolution = expected
|
||||
actual = item.screen_resolution
|
||||
assert_equal expected, actual
|
||||
expected = 'Other string'
|
||||
item.screen_resolution = expected
|
||||
actual = item.screen_resolution
|
||||
assert_equal expected, actual
|
||||
end
|
||||
|
||||
def test_type_works_as_expected
|
||||
expected = 'Test string'
|
||||
expected = 'ElWvwXNQ'
|
||||
item = Contracts::Device.new
|
||||
item.type = expected
|
||||
actual = item.type
|
||||
assert_equal expected, actual
|
||||
expected = 'Other string'
|
||||
expected = 'ZPYQpwGr'
|
||||
item.type = expected
|
||||
actual = item.type
|
||||
assert_equal expected, actual
|
||||
end
|
||||
|
||||
def test_machine_name_works_as_expected
|
||||
expected = 'Test string'
|
||||
item = Contracts::Device.new
|
||||
item.machine_name = expected
|
||||
actual = item.machine_name
|
||||
assert_equal expected, actual
|
||||
expected = 'Other string'
|
||||
item.machine_name = expected
|
||||
actual = item.machine_name
|
||||
assert_equal expected, actual
|
||||
end
|
||||
|
||||
def test_to_json_works_as_expected
|
||||
item = Contracts::Device.new
|
||||
item.id = 'Test string'
|
||||
item.ip = 'Test string'
|
||||
item.language = 'Test string'
|
||||
item.locale = 'Test string'
|
||||
item.model = 'Test string'
|
||||
item.network = 'Test string'
|
||||
item.oem_name = 'Test string'
|
||||
item.os = 'Test string'
|
||||
item.os_version = 'Test string'
|
||||
item.role_instance = 'Test string'
|
||||
item.role_name = 'Test string'
|
||||
item.screen_resolution = 'Test string'
|
||||
item.type = 'Test string'
|
||||
item.machine_name = 'Test string'
|
||||
item.id = 'ELCIfeDG'
|
||||
item.locale = 'aXkpqBWw'
|
||||
item.model = 'mkBCkkHm'
|
||||
item.oem_name = 'EazNnals'
|
||||
item.os_version = 'cQgvEEEr'
|
||||
item.type = 'ElWvwXNQ'
|
||||
actual = item.to_json
|
||||
expected = '{"ai.device.id":"Test string","ai.device.ip":"Test string","ai.device.language":"Test string","ai.device.locale":"Test string","ai.device.model":"Test string","ai.device.network":"Test string","ai.device.oemName":"Test string","ai.device.os":"Test string","ai.device.osVersion":"Test string","ai.device.roleInstance":"Test string","ai.device.roleName":"Test string","ai.device.screenResolution":"Test string","ai.device.type":"Test string","ai.device.machineName":"Test string"}'
|
||||
expected = '{"ai.device.id":"ELCIfeDG","ai.device.locale":"aXkpqBWw","ai.device.model":"mkBCkkHm","ai.device.oemName":"EazNnals","ai.device.osVersion":"cQgvEEEr","ai.device.type":"ElWvwXNQ"}'
|
||||
assert_equal expected, actual
|
||||
end
|
||||
end
|
||||
|
|
|
@ -0,0 +1,18 @@
|
|||
require_relative '../../../../lib/application_insights/channel/contracts/domain'
|
||||
require 'test/unit'
|
||||
|
||||
include ApplicationInsights::Channel
|
||||
|
||||
class TestDomain < Test::Unit::TestCase
|
||||
def test_initialize
|
||||
item = Contracts::Domain.new
|
||||
assert_not_nil item
|
||||
end
|
||||
|
||||
def test_to_json_works_as_expected
|
||||
item = Contracts::Domain.new
|
||||
actual = item.to_json
|
||||
expected = '{}'
|
||||
assert_equal expected, actual
|
||||
end
|
||||
end
|
|
@ -10,161 +10,77 @@ class TestEnvelope < Test::Unit::TestCase
|
|||
end
|
||||
|
||||
def test_ver_works_as_expected
|
||||
expected = 42
|
||||
expected = 80
|
||||
item = Contracts::Envelope.new
|
||||
item.ver = expected
|
||||
actual = item.ver
|
||||
assert_equal expected, actual
|
||||
expected = 13
|
||||
expected = 38
|
||||
item.ver = expected
|
||||
actual = item.ver
|
||||
assert_equal expected, actual
|
||||
end
|
||||
|
||||
def test_name_works_as_expected
|
||||
expected = 'Test string'
|
||||
expected = 'adlchSLC'
|
||||
item = Contracts::Envelope.new
|
||||
item.name = expected
|
||||
actual = item.name
|
||||
assert_equal expected, actual
|
||||
expected = 'Other string'
|
||||
expected = 'BoywoCzj'
|
||||
item.name = expected
|
||||
actual = item.name
|
||||
assert_equal expected, actual
|
||||
end
|
||||
|
||||
def test_time_works_as_expected
|
||||
expected = 'Test string'
|
||||
expected = 'rdfJJhQs'
|
||||
item = Contracts::Envelope.new
|
||||
item.time = expected
|
||||
actual = item.time
|
||||
assert_equal expected, actual
|
||||
expected = 'Other string'
|
||||
expected = 'zotVaJNt'
|
||||
item.time = expected
|
||||
actual = item.time
|
||||
assert_equal expected, actual
|
||||
end
|
||||
|
||||
def test_sample_rate_works_as_expected
|
||||
expected = 1.5
|
||||
expected = 4.3706
|
||||
item = Contracts::Envelope.new
|
||||
item.sample_rate = expected
|
||||
actual = item.sample_rate
|
||||
assert_equal expected, actual
|
||||
expected = 4.8
|
||||
expected = 9.2301
|
||||
item.sample_rate = expected
|
||||
actual = item.sample_rate
|
||||
assert_equal expected, actual
|
||||
end
|
||||
|
||||
def test_seq_works_as_expected
|
||||
expected = 'Test string'
|
||||
expected = 'rCitVJLQ'
|
||||
item = Contracts::Envelope.new
|
||||
item.seq = expected
|
||||
actual = item.seq
|
||||
assert_equal expected, actual
|
||||
expected = 'Other string'
|
||||
expected = 'eTUUGRJV'
|
||||
item.seq = expected
|
||||
actual = item.seq
|
||||
assert_equal expected, actual
|
||||
end
|
||||
|
||||
def test_i_key_works_as_expected
|
||||
expected = 'Test string'
|
||||
expected = 'siOxfiva'
|
||||
item = Contracts::Envelope.new
|
||||
item.i_key = expected
|
||||
actual = item.i_key
|
||||
assert_equal expected, actual
|
||||
expected = 'Other string'
|
||||
expected = 'mhrUZzEP'
|
||||
item.i_key = expected
|
||||
actual = item.i_key
|
||||
assert_equal expected, actual
|
||||
end
|
||||
|
||||
def test_flags_works_as_expected
|
||||
expected = 42
|
||||
item = Contracts::Envelope.new
|
||||
item.flags = expected
|
||||
actual = item.flags
|
||||
assert_equal expected, actual
|
||||
expected = 13
|
||||
item.flags = expected
|
||||
actual = item.flags
|
||||
assert_equal expected, actual
|
||||
end
|
||||
|
||||
def test_device_id_works_as_expected
|
||||
expected = 'Test string'
|
||||
item = Contracts::Envelope.new
|
||||
item.device_id = expected
|
||||
actual = item.device_id
|
||||
assert_equal expected, actual
|
||||
expected = 'Other string'
|
||||
item.device_id = expected
|
||||
actual = item.device_id
|
||||
assert_equal expected, actual
|
||||
end
|
||||
|
||||
def test_os_works_as_expected
|
||||
expected = 'Test string'
|
||||
item = Contracts::Envelope.new
|
||||
item.os = expected
|
||||
actual = item.os
|
||||
assert_equal expected, actual
|
||||
expected = 'Other string'
|
||||
item.os = expected
|
||||
actual = item.os
|
||||
assert_equal expected, actual
|
||||
end
|
||||
|
||||
def test_os_ver_works_as_expected
|
||||
expected = 'Test string'
|
||||
item = Contracts::Envelope.new
|
||||
item.os_ver = expected
|
||||
actual = item.os_ver
|
||||
assert_equal expected, actual
|
||||
expected = 'Other string'
|
||||
item.os_ver = expected
|
||||
actual = item.os_ver
|
||||
assert_equal expected, actual
|
||||
end
|
||||
|
||||
def test_app_id_works_as_expected
|
||||
expected = 'Test string'
|
||||
item = Contracts::Envelope.new
|
||||
item.app_id = expected
|
||||
actual = item.app_id
|
||||
assert_equal expected, actual
|
||||
expected = 'Other string'
|
||||
item.app_id = expected
|
||||
actual = item.app_id
|
||||
assert_equal expected, actual
|
||||
end
|
||||
|
||||
def test_app_ver_works_as_expected
|
||||
expected = 'Test string'
|
||||
item = Contracts::Envelope.new
|
||||
item.app_ver = expected
|
||||
actual = item.app_ver
|
||||
assert_equal expected, actual
|
||||
expected = 'Other string'
|
||||
item.app_ver = expected
|
||||
actual = item.app_ver
|
||||
assert_equal expected, actual
|
||||
end
|
||||
|
||||
def test_user_id_works_as_expected
|
||||
expected = 'Test string'
|
||||
item = Contracts::Envelope.new
|
||||
item.user_id = expected
|
||||
actual = item.user_id
|
||||
assert_equal expected, actual
|
||||
expected = 'Other string'
|
||||
item.user_id = expected
|
||||
actual = item.user_id
|
||||
assert_equal expected, actual
|
||||
end
|
||||
|
||||
def test_tags_works_as_expected
|
||||
item = Contracts::Envelope.new
|
||||
actual = item.tags
|
||||
|
@ -185,25 +101,18 @@ class TestEnvelope < Test::Unit::TestCase
|
|||
|
||||
def test_to_json_works_as_expected
|
||||
item = Contracts::Envelope.new
|
||||
item.ver = 42
|
||||
item.name = 'Test string'
|
||||
item.time = 'Test string'
|
||||
item.sample_rate = 1.5
|
||||
item.seq = 'Test string'
|
||||
item.i_key = 'Test string'
|
||||
item.flags = 42
|
||||
item.device_id = 'Test string'
|
||||
item.os = 'Test string'
|
||||
item.os_ver = 'Test string'
|
||||
item.app_id = 'Test string'
|
||||
item.app_ver = 'Test string'
|
||||
item.user_id = 'Test string'
|
||||
{ 'key1' => 'test value 1' , 'key2' => 'test value 2' }.each do |key, value|
|
||||
item.ver = 80
|
||||
item.name = 'adlchSLC'
|
||||
item.time = 'rdfJJhQs'
|
||||
item.sample_rate = 4.3706
|
||||
item.seq = 'rCitVJLQ'
|
||||
item.i_key = 'siOxfiva'
|
||||
{ 'rMCx' => 'bZQsOeRE' }.each do |key, value|
|
||||
item.tags[key] = value
|
||||
end
|
||||
item.data = { 'key' => 'value' }
|
||||
actual = item.to_json
|
||||
expected = '{"ver":42,"name":"Test string","time":"Test string","sampleRate":1.5,"seq":"Test string","iKey":"Test string","flags":42,"deviceId":"Test string","os":"Test string","osVer":"Test string","appId":"Test string","appVer":"Test string","userId":"Test string","tags":{"key1":"test value 1","key2":"test value 2"},"data":{"key":"value"}}'
|
||||
expected = '{"ver":80,"name":"adlchSLC","time":"rdfJJhQs","sampleRate":4.3706,"seq":"rCitVJLQ","iKey":"siOxfiva","tags":{"rMCx":"bZQsOeRE"},"data":{"key":"value"}}'
|
||||
assert_equal expected, actual
|
||||
end
|
||||
end
|
||||
|
|
|
@ -10,24 +10,24 @@ class TestEventData < Test::Unit::TestCase
|
|||
end
|
||||
|
||||
def test_ver_works_as_expected
|
||||
expected = 42
|
||||
expected = 63
|
||||
item = Contracts::EventData.new
|
||||
item.ver = expected
|
||||
actual = item.ver
|
||||
assert_equal expected, actual
|
||||
expected = 13
|
||||
expected = 21
|
||||
item.ver = expected
|
||||
actual = item.ver
|
||||
assert_equal expected, actual
|
||||
end
|
||||
|
||||
def test_name_works_as_expected
|
||||
expected = 'Test string'
|
||||
expected = 'FPkYRwor'
|
||||
item = Contracts::EventData.new
|
||||
item.name = expected
|
||||
actual = item.name
|
||||
assert_equal expected, actual
|
||||
expected = 'Other string'
|
||||
expected = 'mwxmSpxU'
|
||||
item.name = expected
|
||||
actual = item.name
|
||||
assert_equal expected, actual
|
||||
|
@ -47,16 +47,16 @@ class TestEventData < Test::Unit::TestCase
|
|||
|
||||
def test_to_json_works_as_expected
|
||||
item = Contracts::EventData.new
|
||||
item.ver = 42
|
||||
item.name = 'Test string'
|
||||
{ 'key1' => 'test value 1' , 'key2' => 'test value 2' }.each do |key, value|
|
||||
item.ver = 63
|
||||
item.name = 'FPkYRwor'
|
||||
{ 'fEUK' => 'CmlXfTfm' }.each do |key, value|
|
||||
item.properties[key] = value
|
||||
end
|
||||
{ 'key1' => 3.1415 , 'key2' => 42.2 }.each do |key, value|
|
||||
{ 'WxIM' => 4.509 }.each do |key, value|
|
||||
item.measurements[key] = value
|
||||
end
|
||||
actual = item.to_json
|
||||
expected = '{"ver":42,"name":"Test string","properties":{"key1":"test value 1","key2":"test value 2"},"measurements":{"key1":3.1415,"key2":42.2}}'
|
||||
expected = '{"ver":63,"name":"FPkYRwor","properties":{"fEUK":"CmlXfTfm"},"measurements":{"WxIM":4.509}}'
|
||||
assert_equal expected, actual
|
||||
end
|
||||
end
|
||||
|
|
|
@ -10,29 +10,17 @@ class TestExceptionData < Test::Unit::TestCase
|
|||
end
|
||||
|
||||
def test_ver_works_as_expected
|
||||
expected = 42
|
||||
expected = 31
|
||||
item = Contracts::ExceptionData.new
|
||||
item.ver = expected
|
||||
actual = item.ver
|
||||
assert_equal expected, actual
|
||||
expected = 13
|
||||
expected = 79
|
||||
item.ver = expected
|
||||
actual = item.ver
|
||||
assert_equal expected, actual
|
||||
end
|
||||
|
||||
def test_handled_at_works_as_expected
|
||||
expected = 'Test string'
|
||||
item = Contracts::ExceptionData.new
|
||||
item.handled_at = expected
|
||||
actual = item.handled_at
|
||||
assert_equal expected, actual
|
||||
expected = 'Other string'
|
||||
item.handled_at = expected
|
||||
actual = item.handled_at
|
||||
assert_equal expected, actual
|
||||
end
|
||||
|
||||
def test_exceptions_works_as_expected
|
||||
item = Contracts::ExceptionData.new
|
||||
actual = item.exceptions
|
||||
|
@ -40,41 +28,29 @@ class TestExceptionData < Test::Unit::TestCase
|
|||
end
|
||||
|
||||
def test_severity_level_works_as_expected
|
||||
expected = 5
|
||||
expected = 8
|
||||
item = Contracts::ExceptionData.new
|
||||
item.severity_level = expected
|
||||
actual = item.severity_level
|
||||
assert_equal expected, actual
|
||||
expected = 3
|
||||
expected = 67
|
||||
item.severity_level = expected
|
||||
actual = item.severity_level
|
||||
assert_equal expected, actual
|
||||
end
|
||||
|
||||
def test_problem_id_works_as_expected
|
||||
expected = 'Test string'
|
||||
expected = 'jPyVAuhF'
|
||||
item = Contracts::ExceptionData.new
|
||||
item.problem_id = expected
|
||||
actual = item.problem_id
|
||||
assert_equal expected, actual
|
||||
expected = 'Other string'
|
||||
expected = 'gnqJVAgN'
|
||||
item.problem_id = expected
|
||||
actual = item.problem_id
|
||||
assert_equal expected, actual
|
||||
end
|
||||
|
||||
def test_crash_thread_id_works_as_expected
|
||||
expected = 42
|
||||
item = Contracts::ExceptionData.new
|
||||
item.crash_thread_id = expected
|
||||
actual = item.crash_thread_id
|
||||
assert_equal expected, actual
|
||||
expected = 13
|
||||
item.crash_thread_id = expected
|
||||
actual = item.crash_thread_id
|
||||
assert_equal expected, actual
|
||||
end
|
||||
|
||||
def test_properties_works_as_expected
|
||||
item = Contracts::ExceptionData.new
|
||||
actual = item.properties
|
||||
|
@ -89,23 +65,21 @@ class TestExceptionData < Test::Unit::TestCase
|
|||
|
||||
def test_to_json_works_as_expected
|
||||
item = Contracts::ExceptionData.new
|
||||
item.ver = 42
|
||||
item.handled_at = 'Test string'
|
||||
item.ver = 31
|
||||
[ { 'key' => 'value' } ].each do |value|
|
||||
item.exceptions.push value
|
||||
end
|
||||
|
||||
item.severity_level = 5
|
||||
item.problem_id = 'Test string'
|
||||
item.crash_thread_id = 42
|
||||
{ 'key1' => 'test value 1' , 'key2' => 'test value 2' }.each do |key, value|
|
||||
item.severity_level = 8
|
||||
item.problem_id = 'jPyVAuhF'
|
||||
{ 'Tcep' => 'DaxVFHPr' }.each do |key, value|
|
||||
item.properties[key] = value
|
||||
end
|
||||
{ 'key1' => 3.1415 , 'key2' => 42.2 }.each do |key, value|
|
||||
{ 'kCvi' => 3.3344 }.each do |key, value|
|
||||
item.measurements[key] = value
|
||||
end
|
||||
actual = item.to_json
|
||||
expected = '{"ver":42,"handledAt":"Test string","exceptions":[{"key":"value"}],"severityLevel":5,"problemId":"Test string","crashThreadId":42,"properties":{"key1":"test value 1","key2":"test value 2"},"measurements":{"key1":3.1415,"key2":42.2}}'
|
||||
expected = '{"ver":31,"exceptions":[{"key":"value"}],"severityLevel":8,"problemId":"jPyVAuhF","properties":{"Tcep":"DaxVFHPr"},"measurements":{"kCvi":3.3344}}'
|
||||
assert_equal expected, actual
|
||||
end
|
||||
end
|
||||
|
|
|
@ -10,72 +10,72 @@ class TestExceptionDetails < Test::Unit::TestCase
|
|||
end
|
||||
|
||||
def test_id_works_as_expected
|
||||
expected = 42
|
||||
expected = 98
|
||||
item = Contracts::ExceptionDetails.new
|
||||
item.id = expected
|
||||
actual = item.id
|
||||
assert_equal expected, actual
|
||||
expected = 13
|
||||
expected = 57
|
||||
item.id = expected
|
||||
actual = item.id
|
||||
assert_equal expected, actual
|
||||
end
|
||||
|
||||
def test_outer_id_works_as_expected
|
||||
expected = 42
|
||||
expected = 27
|
||||
item = Contracts::ExceptionDetails.new
|
||||
item.outer_id = expected
|
||||
actual = item.outer_id
|
||||
assert_equal expected, actual
|
||||
expected = 13
|
||||
expected = 51
|
||||
item.outer_id = expected
|
||||
actual = item.outer_id
|
||||
assert_equal expected, actual
|
||||
end
|
||||
|
||||
def test_type_name_works_as_expected
|
||||
expected = 'Test string'
|
||||
expected = 'tqoEGGgl'
|
||||
item = Contracts::ExceptionDetails.new
|
||||
item.type_name = expected
|
||||
actual = item.type_name
|
||||
assert_equal expected, actual
|
||||
expected = 'Other string'
|
||||
expected = 'WYBOaGPb'
|
||||
item.type_name = expected
|
||||
actual = item.type_name
|
||||
assert_equal expected, actual
|
||||
end
|
||||
|
||||
def test_message_works_as_expected
|
||||
expected = 'Test string'
|
||||
expected = 'qThIpXfu'
|
||||
item = Contracts::ExceptionDetails.new
|
||||
item.message = expected
|
||||
actual = item.message
|
||||
assert_equal expected, actual
|
||||
expected = 'Other string'
|
||||
expected = 'xqpwFlLr'
|
||||
item.message = expected
|
||||
actual = item.message
|
||||
assert_equal expected, actual
|
||||
end
|
||||
|
||||
def test_has_full_stack_works_as_expected
|
||||
expected = true
|
||||
expected = TRUE
|
||||
item = Contracts::ExceptionDetails.new
|
||||
item.has_full_stack = expected
|
||||
actual = item.has_full_stack
|
||||
assert_equal expected, actual
|
||||
expected = false
|
||||
expected = FALSE
|
||||
item.has_full_stack = expected
|
||||
actual = item.has_full_stack
|
||||
assert_equal expected, actual
|
||||
end
|
||||
|
||||
def test_stack_works_as_expected
|
||||
expected = 'Test string'
|
||||
expected = 'fLmysXWS'
|
||||
item = Contracts::ExceptionDetails.new
|
||||
item.stack = expected
|
||||
actual = item.stack
|
||||
assert_equal expected, actual
|
||||
expected = 'Other string'
|
||||
expected = 'HxcveEPO'
|
||||
item.stack = expected
|
||||
actual = item.stack
|
||||
assert_equal expected, actual
|
||||
|
@ -89,18 +89,18 @@ class TestExceptionDetails < Test::Unit::TestCase
|
|||
|
||||
def test_to_json_works_as_expected
|
||||
item = Contracts::ExceptionDetails.new
|
||||
item.id = 42
|
||||
item.outer_id = 42
|
||||
item.type_name = 'Test string'
|
||||
item.message = 'Test string'
|
||||
item.has_full_stack = true
|
||||
item.stack = 'Test string'
|
||||
item.id = 98
|
||||
item.outer_id = 27
|
||||
item.type_name = 'tqoEGGgl'
|
||||
item.message = 'qThIpXfu'
|
||||
item.has_full_stack = TRUE
|
||||
item.stack = 'fLmysXWS'
|
||||
[ { 'key' => 'value' } ].each do |value|
|
||||
item.parsed_stack.push value
|
||||
end
|
||||
|
||||
actual = item.to_json
|
||||
expected = '{"id":42,"outerId":42,"typeName":"Test string","message":"Test string","hasFullStack":true,"stack":"Test string","parsedStack":[{"key":"value"}]}'
|
||||
expected = '{"id":98,"outerId":27,"typeName":"tqoEGGgl","message":"qThIpXfu","hasFullStack":true,"stack":"fLmysXWS","parsedStack":[{"key":"value"}]}'
|
||||
assert_equal expected, actual
|
||||
end
|
||||
end
|
||||
|
|
|
@ -10,35 +10,48 @@ class TestInternal < Test::Unit::TestCase
|
|||
end
|
||||
|
||||
def test_sdk_version_works_as_expected
|
||||
expected = 'Test string'
|
||||
expected = 'fmwchHWF'
|
||||
item = Contracts::Internal.new
|
||||
item.sdk_version = expected
|
||||
actual = item.sdk_version
|
||||
assert_equal expected, actual
|
||||
expected = 'Other string'
|
||||
expected = 'eqmowGLD'
|
||||
item.sdk_version = expected
|
||||
actual = item.sdk_version
|
||||
assert_equal expected, actual
|
||||
end
|
||||
|
||||
def test_agent_version_works_as_expected
|
||||
expected = 'Test string'
|
||||
expected = 'eMUeMREZ'
|
||||
item = Contracts::Internal.new
|
||||
item.agent_version = expected
|
||||
actual = item.agent_version
|
||||
assert_equal expected, actual
|
||||
expected = 'Other string'
|
||||
expected = 'QkYKBHbG'
|
||||
item.agent_version = expected
|
||||
actual = item.agent_version
|
||||
assert_equal expected, actual
|
||||
end
|
||||
|
||||
def test_node_name_works_as_expected
|
||||
expected = 'oYvZzjJA'
|
||||
item = Contracts::Internal.new
|
||||
item.node_name = expected
|
||||
actual = item.node_name
|
||||
assert_equal expected, actual
|
||||
expected = 'tfsjdFeA'
|
||||
item.node_name = expected
|
||||
actual = item.node_name
|
||||
assert_equal expected, actual
|
||||
end
|
||||
|
||||
def test_to_json_works_as_expected
|
||||
item = Contracts::Internal.new
|
||||
item.sdk_version = 'Test string'
|
||||
item.agent_version = 'Test string'
|
||||
item.sdk_version = 'fmwchHWF'
|
||||
item.agent_version = 'eMUeMREZ'
|
||||
item.node_name = 'oYvZzjJA'
|
||||
actual = item.to_json
|
||||
expected = '{"ai.internal.sdkVersion":"Test string","ai.internal.agentVersion":"Test string"}'
|
||||
expected = '{"ai.internal.sdkVersion":"fmwchHWF","ai.internal.agentVersion":"eMUeMREZ","ai.internal.nodeName":"oYvZzjJA"}'
|
||||
assert_equal expected, actual
|
||||
end
|
||||
end
|
||||
|
|
|
@ -10,61 +10,22 @@ class TestLocation < Test::Unit::TestCase
|
|||
end
|
||||
|
||||
def test_ip_works_as_expected
|
||||
expected = 'Test string'
|
||||
expected = 'hmrnPNLx'
|
||||
item = Contracts::Location.new
|
||||
item.ip = expected
|
||||
actual = item.ip
|
||||
assert_equal expected, actual
|
||||
expected = 'Other string'
|
||||
expected = 'WjNsWtwq'
|
||||
item.ip = expected
|
||||
actual = item.ip
|
||||
assert_equal expected, actual
|
||||
end
|
||||
|
||||
def test_country_works_as_expected
|
||||
expected = 'Test string'
|
||||
item = Contracts::Location.new
|
||||
item.country = expected
|
||||
actual = item.country
|
||||
assert_equal expected, actual
|
||||
expected = 'Other string'
|
||||
item.country = expected
|
||||
actual = item.country
|
||||
assert_equal expected, actual
|
||||
end
|
||||
|
||||
def test_province_works_as_expected
|
||||
expected = 'Test string'
|
||||
item = Contracts::Location.new
|
||||
item.province = expected
|
||||
actual = item.province
|
||||
assert_equal expected, actual
|
||||
expected = 'Other string'
|
||||
item.province = expected
|
||||
actual = item.province
|
||||
assert_equal expected, actual
|
||||
end
|
||||
|
||||
def test_city_works_as_expected
|
||||
expected = 'Test string'
|
||||
item = Contracts::Location.new
|
||||
item.city = expected
|
||||
actual = item.city
|
||||
assert_equal expected, actual
|
||||
expected = 'Other string'
|
||||
item.city = expected
|
||||
actual = item.city
|
||||
assert_equal expected, actual
|
||||
end
|
||||
|
||||
def test_to_json_works_as_expected
|
||||
item = Contracts::Location.new
|
||||
item.ip = 'Test string'
|
||||
item.country = 'US'
|
||||
item.province = 'WA'
|
||||
item.city = 'Redmond'
|
||||
item.ip = 'hmrnPNLx'
|
||||
actual = item.to_json
|
||||
expected = '{"ai.location.ip":"Test string","ai.location.country":"US","ai.location.province":"WA","ai.location.city":"Redmond"}'
|
||||
expected = '{"ai.location.ip":"hmrnPNLx"}'
|
||||
assert_equal expected, actual
|
||||
end
|
||||
end
|
||||
|
|
|
@ -10,36 +10,36 @@ class TestMessageData < Test::Unit::TestCase
|
|||
end
|
||||
|
||||
def test_ver_works_as_expected
|
||||
expected = 42
|
||||
expected = 38
|
||||
item = Contracts::MessageData.new
|
||||
item.ver = expected
|
||||
actual = item.ver
|
||||
assert_equal expected, actual
|
||||
expected = 13
|
||||
expected = 92
|
||||
item.ver = expected
|
||||
actual = item.ver
|
||||
assert_equal expected, actual
|
||||
end
|
||||
|
||||
def test_message_works_as_expected
|
||||
expected = 'Test string'
|
||||
expected = 'cYQXvzXJ'
|
||||
item = Contracts::MessageData.new
|
||||
item.message = expected
|
||||
actual = item.message
|
||||
assert_equal expected, actual
|
||||
expected = 'Other string'
|
||||
expected = 'ULhtEnAd'
|
||||
item.message = expected
|
||||
actual = item.message
|
||||
assert_equal expected, actual
|
||||
end
|
||||
|
||||
def test_severity_level_works_as_expected
|
||||
expected = 5
|
||||
expected = 91
|
||||
item = Contracts::MessageData.new
|
||||
item.severity_level = expected
|
||||
actual = item.severity_level
|
||||
assert_equal expected, actual
|
||||
expected = 3
|
||||
expected = 30
|
||||
item.severity_level = expected
|
||||
actual = item.severity_level
|
||||
assert_equal expected, actual
|
||||
|
@ -53,14 +53,14 @@ class TestMessageData < Test::Unit::TestCase
|
|||
|
||||
def test_to_json_works_as_expected
|
||||
item = Contracts::MessageData.new
|
||||
item.ver = 42
|
||||
item.message = 'Test string'
|
||||
item.severity_level = 5
|
||||
{ 'key1' => 'test value 1' , 'key2' => 'test value 2' }.each do |key, value|
|
||||
item.ver = 38
|
||||
item.message = 'cYQXvzXJ'
|
||||
item.severity_level = 91
|
||||
{ 'yCBA' => 'KevMpBvm' }.each do |key, value|
|
||||
item.properties[key] = value
|
||||
end
|
||||
actual = item.to_json
|
||||
expected = '{"ver":42,"message":"Test string","severityLevel":5,"properties":{"key1":"test value 1","key2":"test value 2"}}'
|
||||
expected = '{"ver":38,"message":"cYQXvzXJ","severityLevel":91,"properties":{"yCBA":"KevMpBvm"}}'
|
||||
assert_equal expected, actual
|
||||
end
|
||||
end
|
||||
|
|
|
@ -10,12 +10,12 @@ class TestMetricData < Test::Unit::TestCase
|
|||
end
|
||||
|
||||
def test_ver_works_as_expected
|
||||
expected = 42
|
||||
expected = 56
|
||||
item = Contracts::MetricData.new
|
||||
item.ver = expected
|
||||
actual = item.ver
|
||||
assert_equal expected, actual
|
||||
expected = 13
|
||||
expected = 38
|
||||
item.ver = expected
|
||||
actual = item.ver
|
||||
assert_equal expected, actual
|
||||
|
@ -35,16 +35,16 @@ class TestMetricData < Test::Unit::TestCase
|
|||
|
||||
def test_to_json_works_as_expected
|
||||
item = Contracts::MetricData.new
|
||||
item.ver = 42
|
||||
item.ver = 56
|
||||
[ { 'key' => 'value' } ].each do |value|
|
||||
item.metrics.push value
|
||||
end
|
||||
|
||||
{ 'key1' => 'test value 1' , 'key2' => 'test value 2' }.each do |key, value|
|
||||
{ 'nUVt' => 'UsxiClbK' }.each do |key, value|
|
||||
item.properties[key] = value
|
||||
end
|
||||
actual = item.to_json
|
||||
expected = '{"ver":42,"metrics":[{"key":"value"}],"properties":{"key1":"test value 1","key2":"test value 2"}}'
|
||||
expected = '{"ver":56,"metrics":[{"key":"value"}],"properties":{"nUVt":"UsxiClbK"}}'
|
||||
assert_equal expected, actual
|
||||
end
|
||||
end
|
||||
|
|
|
@ -10,84 +10,60 @@ class TestOperation < Test::Unit::TestCase
|
|||
end
|
||||
|
||||
def test_id_works_as_expected
|
||||
expected = 'Test string'
|
||||
expected = 'xgpiibGZ'
|
||||
item = Contracts::Operation.new
|
||||
item.id = expected
|
||||
actual = item.id
|
||||
assert_equal expected, actual
|
||||
expected = 'Other string'
|
||||
expected = 'AHBwRDsJ'
|
||||
item.id = expected
|
||||
actual = item.id
|
||||
assert_equal expected, actual
|
||||
end
|
||||
|
||||
def test_name_works_as_expected
|
||||
expected = 'Test string'
|
||||
expected = 'Azjyxlyr'
|
||||
item = Contracts::Operation.new
|
||||
item.name = expected
|
||||
actual = item.name
|
||||
assert_equal expected, actual
|
||||
expected = 'Other string'
|
||||
expected = 'XbRrfAgL'
|
||||
item.name = expected
|
||||
actual = item.name
|
||||
assert_equal expected, actual
|
||||
end
|
||||
|
||||
def test_parent_id_works_as_expected
|
||||
expected = 'Test string'
|
||||
expected = 'suDJVmiw'
|
||||
item = Contracts::Operation.new
|
||||
item.parent_id = expected
|
||||
actual = item.parent_id
|
||||
assert_equal expected, actual
|
||||
expected = 'Other string'
|
||||
expected = 'FPKAsoNX'
|
||||
item.parent_id = expected
|
||||
actual = item.parent_id
|
||||
assert_equal expected, actual
|
||||
end
|
||||
|
||||
def test_root_id_works_as_expected
|
||||
expected = 'Test string'
|
||||
item = Contracts::Operation.new
|
||||
item.root_id = expected
|
||||
actual = item.root_id
|
||||
assert_equal expected, actual
|
||||
expected = 'Other string'
|
||||
item.root_id = expected
|
||||
actual = item.root_id
|
||||
assert_equal expected, actual
|
||||
end
|
||||
|
||||
def test_synthetic_source_works_as_expected
|
||||
expected = 'Test string'
|
||||
expected = 'HoeKGdhh'
|
||||
item = Contracts::Operation.new
|
||||
item.synthetic_source = expected
|
||||
actual = item.synthetic_source
|
||||
assert_equal expected, actual
|
||||
expected = 'Other string'
|
||||
expected = 'nmKPjenu'
|
||||
item.synthetic_source = expected
|
||||
actual = item.synthetic_source
|
||||
assert_equal expected, actual
|
||||
end
|
||||
|
||||
def test_is_synthetic_works_as_expected
|
||||
expected = 'Test string'
|
||||
item = Contracts::Operation.new
|
||||
item.is_synthetic = expected
|
||||
actual = item.is_synthetic
|
||||
assert_equal expected, actual
|
||||
expected = 'Other string'
|
||||
item.is_synthetic = expected
|
||||
actual = item.is_synthetic
|
||||
assert_equal expected, actual
|
||||
end
|
||||
|
||||
def test_correlation_vector_works_as_expected
|
||||
expected = 'Test string'
|
||||
expected = 'OtLgtpLh'
|
||||
item = Contracts::Operation.new
|
||||
item.correlation_vector = expected
|
||||
actual = item.correlation_vector
|
||||
assert_equal expected, actual
|
||||
expected = 'Other string'
|
||||
expected = 'XcyzqKpA'
|
||||
item.correlation_vector = expected
|
||||
actual = item.correlation_vector
|
||||
assert_equal expected, actual
|
||||
|
@ -95,15 +71,13 @@ class TestOperation < Test::Unit::TestCase
|
|||
|
||||
def test_to_json_works_as_expected
|
||||
item = Contracts::Operation.new
|
||||
item.id = 'Test string'
|
||||
item.name = 'Test string'
|
||||
item.parent_id = 'Test string'
|
||||
item.root_id = 'Test string'
|
||||
item.synthetic_source = 'Test string'
|
||||
item.is_synthetic = 'Test string'
|
||||
item.correlation_vector = 'Test string'
|
||||
item.id = 'xgpiibGZ'
|
||||
item.name = 'Azjyxlyr'
|
||||
item.parent_id = 'suDJVmiw'
|
||||
item.synthetic_source = 'HoeKGdhh'
|
||||
item.correlation_vector = 'OtLgtpLh'
|
||||
actual = item.to_json
|
||||
expected = '{"ai.operation.id":"Test string","ai.operation.name":"Test string","ai.operation.parentId":"Test string","ai.operation.rootId":"Test string","ai.operation.syntheticSource":"Test string","ai.operation.isSynthetic":"Test string","ai.operation.correlationVector":"Test string"}'
|
||||
expected = '{"ai.operation.id":"xgpiibGZ","ai.operation.name":"Azjyxlyr","ai.operation.parentId":"suDJVmiw","ai.operation.syntheticSource":"HoeKGdhh","ai.operation.correlationVector":"OtLgtpLh"}'
|
||||
assert_equal expected, actual
|
||||
end
|
||||
end
|
||||
|
|
|
@ -10,53 +10,77 @@ class TestPageViewData < Test::Unit::TestCase
|
|||
end
|
||||
|
||||
def test_ver_works_as_expected
|
||||
expected = 42
|
||||
expected = 63
|
||||
item = Contracts::PageViewData.new
|
||||
item.ver = expected
|
||||
actual = item.ver
|
||||
assert_equal expected, actual
|
||||
expected = 13
|
||||
expected = 21
|
||||
item.ver = expected
|
||||
actual = item.ver
|
||||
assert_equal expected, actual
|
||||
end
|
||||
|
||||
def test_url_works_as_expected
|
||||
expected = 'Test string'
|
||||
expected = 'nxcKNxAq'
|
||||
item = Contracts::PageViewData.new
|
||||
item.url = expected
|
||||
actual = item.url
|
||||
assert_equal expected, actual
|
||||
expected = 'Other string'
|
||||
expected = 'bjKAYrGi'
|
||||
item.url = expected
|
||||
actual = item.url
|
||||
assert_equal expected, actual
|
||||
end
|
||||
|
||||
def test_name_works_as_expected
|
||||
expected = 'Test string'
|
||||
expected = 'FPkYRwor'
|
||||
item = Contracts::PageViewData.new
|
||||
item.name = expected
|
||||
actual = item.name
|
||||
assert_equal expected, actual
|
||||
expected = 'Other string'
|
||||
expected = 'mwxmSpxU'
|
||||
item.name = expected
|
||||
actual = item.name
|
||||
assert_equal expected, actual
|
||||
end
|
||||
|
||||
def test_duration_works_as_expected
|
||||
expected = 'Test string'
|
||||
expected = 'WaazkJXv'
|
||||
item = Contracts::PageViewData.new
|
||||
item.duration = expected
|
||||
actual = item.duration
|
||||
assert_equal expected, actual
|
||||
expected = 'Other string'
|
||||
expected = 'NjcZUfcw'
|
||||
item.duration = expected
|
||||
actual = item.duration
|
||||
assert_equal expected, actual
|
||||
end
|
||||
|
||||
def test_id_works_as_expected
|
||||
expected = 'wXTUMDUP'
|
||||
item = Contracts::PageViewData.new
|
||||
item.id = expected
|
||||
actual = item.id
|
||||
assert_equal expected, actual
|
||||
expected = 'cgSQSTiU'
|
||||
item.id = expected
|
||||
actual = item.id
|
||||
assert_equal expected, actual
|
||||
end
|
||||
|
||||
def test_referrer_uri_works_as_expected
|
||||
expected = 'xatkciOm'
|
||||
item = Contracts::PageViewData.new
|
||||
item.referrer_uri = expected
|
||||
actual = item.referrer_uri
|
||||
assert_equal expected, actual
|
||||
expected = 'RDgezsNB'
|
||||
item.referrer_uri = expected
|
||||
actual = item.referrer_uri
|
||||
assert_equal expected, actual
|
||||
end
|
||||
|
||||
def test_properties_works_as_expected
|
||||
item = Contracts::PageViewData.new
|
||||
actual = item.properties
|
||||
|
@ -71,18 +95,28 @@ class TestPageViewData < Test::Unit::TestCase
|
|||
|
||||
def test_to_json_works_as_expected
|
||||
item = Contracts::PageViewData.new
|
||||
item.ver = 42
|
||||
item.url = 'Test string'
|
||||
item.name = 'Test string'
|
||||
item.duration = 'Test string'
|
||||
{ 'key1' => 'test value 1' , 'key2' => 'test value 2' }.each do |key, value|
|
||||
item.ver = 63
|
||||
item.name = 'FPkYRwor'
|
||||
{ 'fEUK' => 'CmlXfTfm' }.each do |key, value|
|
||||
item.properties[key] = value
|
||||
end
|
||||
{ 'key1' => 3.1415 , 'key2' => 42.2 }.each do |key, value|
|
||||
{ 'WxIM' => 4.509 }.each do |key, value|
|
||||
item.measurements[key] = value
|
||||
end
|
||||
item.ver = 63
|
||||
item.url = 'nxcKNxAq'
|
||||
item.name = 'FPkYRwor'
|
||||
item.duration = 'WaazkJXv'
|
||||
item.id = 'wXTUMDUP'
|
||||
item.referrer_uri = 'xatkciOm'
|
||||
{ 'fEUK' => 'CmlXfTfm' }.each do |key, value|
|
||||
item.properties[key] = value
|
||||
end
|
||||
{ 'WxIM' => 4.509 }.each do |key, value|
|
||||
item.measurements[key] = value
|
||||
end
|
||||
actual = item.to_json
|
||||
expected = '{"ver":42,"url":"Test string","name":"Test string","duration":"Test string","properties":{"key1":"test value 1","key2":"test value 2"},"measurements":{"key1":3.1415,"key2":42.2}}'
|
||||
expected = '{"ver":63,"name":"FPkYRwor","properties":{"fEUK":"CmlXfTfm"},"measurements":{"WxIM":4.509},"url":"nxcKNxAq","duration":"WaazkJXv","id":"wXTUMDUP","referrerUri":"xatkciOm"}'
|
||||
assert_equal expected, actual
|
||||
end
|
||||
end
|
||||
|
|
|
@ -0,0 +1,243 @@
|
|||
require_relative '../../../../lib/application_insights/channel/contracts/page_view_perf_data'
|
||||
require 'test/unit'
|
||||
|
||||
include ApplicationInsights::Channel
|
||||
|
||||
class TestPageViewPerfData < Test::Unit::TestCase
|
||||
def test_initialize
|
||||
item = Contracts::PageViewPerfData.new
|
||||
assert_not_nil item
|
||||
end
|
||||
|
||||
def test_ver_works_as_expected
|
||||
expected = 63
|
||||
item = Contracts::PageViewPerfData.new
|
||||
item.ver = expected
|
||||
actual = item.ver
|
||||
assert_equal expected, actual
|
||||
expected = 21
|
||||
item.ver = expected
|
||||
actual = item.ver
|
||||
assert_equal expected, actual
|
||||
end
|
||||
|
||||
def test_ver_works_as_expected
|
||||
expected = 63
|
||||
item = Contracts::PageViewPerfData.new
|
||||
item.ver = expected
|
||||
actual = item.ver
|
||||
assert_equal expected, actual
|
||||
expected = 21
|
||||
item.ver = expected
|
||||
actual = item.ver
|
||||
assert_equal expected, actual
|
||||
end
|
||||
|
||||
def test_url_works_as_expected
|
||||
expected = 'nxcKNxAq'
|
||||
item = Contracts::PageViewPerfData.new
|
||||
item.url = expected
|
||||
actual = item.url
|
||||
assert_equal expected, actual
|
||||
expected = 'bjKAYrGi'
|
||||
item.url = expected
|
||||
actual = item.url
|
||||
assert_equal expected, actual
|
||||
end
|
||||
|
||||
def test_perf_total_works_as_expected
|
||||
expected = 'jItXKRPj'
|
||||
item = Contracts::PageViewPerfData.new
|
||||
item.perf_total = expected
|
||||
actual = item.perf_total
|
||||
assert_equal expected, actual
|
||||
expected = 'UTJiZJzM'
|
||||
item.perf_total = expected
|
||||
actual = item.perf_total
|
||||
assert_equal expected, actual
|
||||
end
|
||||
|
||||
def test_name_works_as_expected
|
||||
expected = 'FPkYRwor'
|
||||
item = Contracts::PageViewPerfData.new
|
||||
item.name = expected
|
||||
actual = item.name
|
||||
assert_equal expected, actual
|
||||
expected = 'mwxmSpxU'
|
||||
item.name = expected
|
||||
actual = item.name
|
||||
assert_equal expected, actual
|
||||
end
|
||||
|
||||
def test_name_works_as_expected
|
||||
expected = 'FPkYRwor'
|
||||
item = Contracts::PageViewPerfData.new
|
||||
item.name = expected
|
||||
actual = item.name
|
||||
assert_equal expected, actual
|
||||
expected = 'mwxmSpxU'
|
||||
item.name = expected
|
||||
actual = item.name
|
||||
assert_equal expected, actual
|
||||
end
|
||||
|
||||
def test_duration_works_as_expected
|
||||
expected = 'WaazkJXv'
|
||||
item = Contracts::PageViewPerfData.new
|
||||
item.duration = expected
|
||||
actual = item.duration
|
||||
assert_equal expected, actual
|
||||
expected = 'NjcZUfcw'
|
||||
item.duration = expected
|
||||
actual = item.duration
|
||||
assert_equal expected, actual
|
||||
end
|
||||
|
||||
def test_network_connect_works_as_expected
|
||||
expected = 'zkjWxHlP'
|
||||
item = Contracts::PageViewPerfData.new
|
||||
item.network_connect = expected
|
||||
actual = item.network_connect
|
||||
assert_equal expected, actual
|
||||
expected = 'xTSQXzFa'
|
||||
item.network_connect = expected
|
||||
actual = item.network_connect
|
||||
assert_equal expected, actual
|
||||
end
|
||||
|
||||
def test_sent_request_works_as_expected
|
||||
expected = 'CeetTzfH'
|
||||
item = Contracts::PageViewPerfData.new
|
||||
item.sent_request = expected
|
||||
actual = item.sent_request
|
||||
assert_equal expected, actual
|
||||
expected = 'bpEapcOu'
|
||||
item.sent_request = expected
|
||||
actual = item.sent_request
|
||||
assert_equal expected, actual
|
||||
end
|
||||
|
||||
def test_received_response_works_as_expected
|
||||
expected = 'ZhZDxeDE'
|
||||
item = Contracts::PageViewPerfData.new
|
||||
item.received_response = expected
|
||||
actual = item.received_response
|
||||
assert_equal expected, actual
|
||||
expected = 'rssHVaMn'
|
||||
item.received_response = expected
|
||||
actual = item.received_response
|
||||
assert_equal expected, actual
|
||||
end
|
||||
|
||||
def test_id_works_as_expected
|
||||
expected = 'wXTUMDUP'
|
||||
item = Contracts::PageViewPerfData.new
|
||||
item.id = expected
|
||||
actual = item.id
|
||||
assert_equal expected, actual
|
||||
expected = 'cgSQSTiU'
|
||||
item.id = expected
|
||||
actual = item.id
|
||||
assert_equal expected, actual
|
||||
end
|
||||
|
||||
def test_dom_processing_works_as_expected
|
||||
expected = 'GWUjOWso'
|
||||
item = Contracts::PageViewPerfData.new
|
||||
item.dom_processing = expected
|
||||
actual = item.dom_processing
|
||||
assert_equal expected, actual
|
||||
expected = 'HgOuCeTT'
|
||||
item.dom_processing = expected
|
||||
actual = item.dom_processing
|
||||
assert_equal expected, actual
|
||||
end
|
||||
|
||||
def test_referrer_uri_works_as_expected
|
||||
expected = 'xatkciOm'
|
||||
item = Contracts::PageViewPerfData.new
|
||||
item.referrer_uri = expected
|
||||
actual = item.referrer_uri
|
||||
assert_equal expected, actual
|
||||
expected = 'RDgezsNB'
|
||||
item.referrer_uri = expected
|
||||
actual = item.referrer_uri
|
||||
assert_equal expected, actual
|
||||
end
|
||||
|
||||
def test_properties_works_as_expected
|
||||
item = Contracts::PageViewPerfData.new
|
||||
actual = item.properties
|
||||
assert_not_nil actual
|
||||
end
|
||||
|
||||
def test_properties_works_as_expected
|
||||
item = Contracts::PageViewPerfData.new
|
||||
actual = item.properties
|
||||
assert_not_nil actual
|
||||
end
|
||||
|
||||
def test_measurements_works_as_expected
|
||||
item = Contracts::PageViewPerfData.new
|
||||
actual = item.measurements
|
||||
assert_not_nil actual
|
||||
end
|
||||
|
||||
def test_measurements_works_as_expected
|
||||
item = Contracts::PageViewPerfData.new
|
||||
actual = item.measurements
|
||||
assert_not_nil actual
|
||||
end
|
||||
|
||||
def test_to_json_works_as_expected
|
||||
item = Contracts::PageViewPerfData.new
|
||||
item.ver = 63
|
||||
item.name = 'FPkYRwor'
|
||||
{ 'fEUK' => 'CmlXfTfm' }.each do |key, value|
|
||||
item.properties[key] = value
|
||||
end
|
||||
{ 'WxIM' => 4.509 }.each do |key, value|
|
||||
item.measurements[key] = value
|
||||
end
|
||||
item.ver = 63
|
||||
item.url = 'nxcKNxAq'
|
||||
item.name = 'FPkYRwor'
|
||||
item.duration = 'WaazkJXv'
|
||||
item.id = 'wXTUMDUP'
|
||||
item.referrer_uri = 'xatkciOm'
|
||||
{ 'fEUK' => 'CmlXfTfm' }.each do |key, value|
|
||||
item.properties[key] = value
|
||||
end
|
||||
{ 'WxIM' => 4.509 }.each do |key, value|
|
||||
item.measurements[key] = value
|
||||
end
|
||||
item.ver = 63
|
||||
item.ver = 63
|
||||
item.url = 'nxcKNxAq'
|
||||
item.perf_total = 'jItXKRPj'
|
||||
item.name = 'FPkYRwor'
|
||||
item.name = 'FPkYRwor'
|
||||
item.duration = 'WaazkJXv'
|
||||
item.network_connect = 'zkjWxHlP'
|
||||
item.sent_request = 'CeetTzfH'
|
||||
item.received_response = 'ZhZDxeDE'
|
||||
item.id = 'wXTUMDUP'
|
||||
item.dom_processing = 'GWUjOWso'
|
||||
item.referrer_uri = 'xatkciOm'
|
||||
{ 'fEUK' => 'CmlXfTfm' }.each do |key, value|
|
||||
item.properties[key] = value
|
||||
end
|
||||
{ 'fEUK' => 'CmlXfTfm' }.each do |key, value|
|
||||
item.properties[key] = value
|
||||
end
|
||||
{ 'WxIM' => 4.509 }.each do |key, value|
|
||||
item.measurements[key] = value
|
||||
end
|
||||
{ 'WxIM' => 4.509 }.each do |key, value|
|
||||
item.measurements[key] = value
|
||||
end
|
||||
actual = item.to_json
|
||||
expected = '{"ver":63,"name":"FPkYRwor","properties":{"fEUK":"CmlXfTfm"},"measurements":{"WxIM":4.509},"url":"nxcKNxAq","duration":"WaazkJXv","id":"wXTUMDUP","referrerUri":"xatkciOm","perfTotal":"jItXKRPj","networkConnect":"zkjWxHlP","sentRequest":"CeetTzfH","receivedResponse":"ZhZDxeDE","domProcessing":"GWUjOWso"}'
|
||||
assert_equal expected, actual
|
||||
end
|
||||
end
|
|
@ -10,170 +10,110 @@ class TestRemoteDependencyData < Test::Unit::TestCase
|
|||
end
|
||||
|
||||
def test_ver_works_as_expected
|
||||
expected = 42
|
||||
expected = 60
|
||||
item = Contracts::RemoteDependencyData.new
|
||||
item.ver = expected
|
||||
actual = item.ver
|
||||
assert_equal expected, actual
|
||||
expected = 13
|
||||
expected = 92
|
||||
item.ver = expected
|
||||
actual = item.ver
|
||||
assert_equal expected, actual
|
||||
end
|
||||
|
||||
def test_name_works_as_expected
|
||||
expected = 'Test string'
|
||||
expected = 'ImFOjAtD'
|
||||
item = Contracts::RemoteDependencyData.new
|
||||
item.name = expected
|
||||
actual = item.name
|
||||
assert_equal expected, actual
|
||||
expected = 'Other string'
|
||||
expected = 'xXicyvLb'
|
||||
item.name = expected
|
||||
actual = item.name
|
||||
assert_equal expected, actual
|
||||
end
|
||||
|
||||
def test_kind_works_as_expected
|
||||
expected = 5
|
||||
def test_id_works_as_expected
|
||||
expected = 'OEyKTSXC'
|
||||
item = Contracts::RemoteDependencyData.new
|
||||
item.kind = expected
|
||||
actual = item.kind
|
||||
item.id = expected
|
||||
actual = item.id
|
||||
assert_equal expected, actual
|
||||
expected = 3
|
||||
item.kind = expected
|
||||
actual = item.kind
|
||||
expected = 'BGyiNivx'
|
||||
item.id = expected
|
||||
actual = item.id
|
||||
assert_equal expected, actual
|
||||
end
|
||||
|
||||
def test_value_works_as_expected
|
||||
expected = 1.5
|
||||
def test_result_code_works_as_expected
|
||||
expected = 'RRBLmlBX'
|
||||
item = Contracts::RemoteDependencyData.new
|
||||
item.value = expected
|
||||
actual = item.value
|
||||
item.result_code = expected
|
||||
actual = item.result_code
|
||||
assert_equal expected, actual
|
||||
expected = 4.8
|
||||
item.value = expected
|
||||
actual = item.value
|
||||
expected = 'eTppvBwT'
|
||||
item.result_code = expected
|
||||
actual = item.result_code
|
||||
assert_equal expected, actual
|
||||
end
|
||||
|
||||
def test_count_works_as_expected
|
||||
expected = 42
|
||||
def test_duration_works_as_expected
|
||||
expected = 'qsFxgsJU'
|
||||
item = Contracts::RemoteDependencyData.new
|
||||
item.count = expected
|
||||
actual = item.count
|
||||
item.duration = expected
|
||||
actual = item.duration
|
||||
assert_equal expected, actual
|
||||
expected = 13
|
||||
item.count = expected
|
||||
actual = item.count
|
||||
assert_equal expected, actual
|
||||
end
|
||||
|
||||
def test_min_works_as_expected
|
||||
expected = 1.5
|
||||
item = Contracts::RemoteDependencyData.new
|
||||
item.min = expected
|
||||
actual = item.min
|
||||
assert_equal expected, actual
|
||||
expected = 4.8
|
||||
item.min = expected
|
||||
actual = item.min
|
||||
assert_equal expected, actual
|
||||
end
|
||||
|
||||
def test_max_works_as_expected
|
||||
expected = 1.5
|
||||
item = Contracts::RemoteDependencyData.new
|
||||
item.max = expected
|
||||
actual = item.max
|
||||
assert_equal expected, actual
|
||||
expected = 4.8
|
||||
item.max = expected
|
||||
actual = item.max
|
||||
assert_equal expected, actual
|
||||
end
|
||||
|
||||
def test_std_dev_works_as_expected
|
||||
expected = 1.5
|
||||
item = Contracts::RemoteDependencyData.new
|
||||
item.std_dev = expected
|
||||
actual = item.std_dev
|
||||
assert_equal expected, actual
|
||||
expected = 4.8
|
||||
item.std_dev = expected
|
||||
actual = item.std_dev
|
||||
assert_equal expected, actual
|
||||
end
|
||||
|
||||
def test_dependency_kind_works_as_expected
|
||||
expected = 5
|
||||
item = Contracts::RemoteDependencyData.new
|
||||
item.dependency_kind = expected
|
||||
actual = item.dependency_kind
|
||||
assert_equal expected, actual
|
||||
expected = 3
|
||||
item.dependency_kind = expected
|
||||
actual = item.dependency_kind
|
||||
expected = 'vmAnrvkN'
|
||||
item.duration = expected
|
||||
actual = item.duration
|
||||
assert_equal expected, actual
|
||||
end
|
||||
|
||||
def test_success_works_as_expected
|
||||
expected = true
|
||||
expected = FALSE
|
||||
item = Contracts::RemoteDependencyData.new
|
||||
item.success = expected
|
||||
actual = item.success
|
||||
assert_equal expected, actual
|
||||
expected = false
|
||||
expected = TRUE
|
||||
item.success = expected
|
||||
actual = item.success
|
||||
assert_equal expected, actual
|
||||
end
|
||||
|
||||
def test_async_works_as_expected
|
||||
expected = true
|
||||
def test_data_works_as_expected
|
||||
expected = 'NbtmHjWq'
|
||||
item = Contracts::RemoteDependencyData.new
|
||||
item.async = expected
|
||||
actual = item.async
|
||||
item.data = expected
|
||||
actual = item.data
|
||||
assert_equal expected, actual
|
||||
expected = false
|
||||
item.async = expected
|
||||
actual = item.async
|
||||
expected = 'CqhRgUsx'
|
||||
item.data = expected
|
||||
actual = item.data
|
||||
assert_equal expected, actual
|
||||
end
|
||||
|
||||
def test_dependency_source_works_as_expected
|
||||
expected = 5
|
||||
def test_target_works_as_expected
|
||||
expected = 'MlNaqxPw'
|
||||
item = Contracts::RemoteDependencyData.new
|
||||
item.dependency_source = expected
|
||||
actual = item.dependency_source
|
||||
item.target = expected
|
||||
actual = item.target
|
||||
assert_equal expected, actual
|
||||
expected = 3
|
||||
item.dependency_source = expected
|
||||
actual = item.dependency_source
|
||||
expected = 'yUXiGybP'
|
||||
item.target = expected
|
||||
actual = item.target
|
||||
assert_equal expected, actual
|
||||
end
|
||||
|
||||
def test_command_name_works_as_expected
|
||||
expected = 'Test string'
|
||||
def test_type_works_as_expected
|
||||
expected = 'yvCcYRVC'
|
||||
item = Contracts::RemoteDependencyData.new
|
||||
item.command_name = expected
|
||||
actual = item.command_name
|
||||
item.type = expected
|
||||
actual = item.type
|
||||
assert_equal expected, actual
|
||||
expected = 'Other string'
|
||||
item.command_name = expected
|
||||
actual = item.command_name
|
||||
assert_equal expected, actual
|
||||
end
|
||||
|
||||
def test_dependency_type_name_works_as_expected
|
||||
expected = 'Test string'
|
||||
item = Contracts::RemoteDependencyData.new
|
||||
item.dependency_type_name = expected
|
||||
actual = item.dependency_type_name
|
||||
assert_equal expected, actual
|
||||
expected = 'Other string'
|
||||
item.dependency_type_name = expected
|
||||
actual = item.dependency_type_name
|
||||
expected = 'lSKNVkCA'
|
||||
item.type = expected
|
||||
actual = item.type
|
||||
assert_equal expected, actual
|
||||
end
|
||||
|
||||
|
@ -183,27 +123,31 @@ class TestRemoteDependencyData < Test::Unit::TestCase
|
|||
assert_not_nil actual
|
||||
end
|
||||
|
||||
def test_measurements_works_as_expected
|
||||
item = Contracts::RemoteDependencyData.new
|
||||
actual = item.measurements
|
||||
assert_not_nil actual
|
||||
end
|
||||
|
||||
def test_to_json_works_as_expected
|
||||
item = Contracts::RemoteDependencyData.new
|
||||
item.ver = 42
|
||||
item.name = 'Test string'
|
||||
item.kind = 5
|
||||
item.value = 1.5
|
||||
item.count = 42
|
||||
item.min = 1.5
|
||||
item.max = 1.5
|
||||
item.std_dev = 1.5
|
||||
item.dependency_kind = 5
|
||||
item.success = true
|
||||
item.async = true
|
||||
item.dependency_source = 5
|
||||
item.command_name = 'Test string'
|
||||
item.dependency_type_name = 'Test string'
|
||||
{ 'key1' => 'test value 1' , 'key2' => 'test value 2' }.each do |key, value|
|
||||
item.ver = 60
|
||||
item.name = 'ImFOjAtD'
|
||||
item.id = 'OEyKTSXC'
|
||||
item.result_code = 'RRBLmlBX'
|
||||
item.duration = 'qsFxgsJU'
|
||||
item.success = FALSE
|
||||
item.data = 'NbtmHjWq'
|
||||
item.target = 'MlNaqxPw'
|
||||
item.type = 'yvCcYRVC'
|
||||
{ 'dpeP' => 'BBXyWyVy' }.each do |key, value|
|
||||
item.properties[key] = value
|
||||
end
|
||||
{ 'srjL' => 0.262 }.each do |key, value|
|
||||
item.measurements[key] = value
|
||||
end
|
||||
actual = item.to_json
|
||||
expected = '{"ver":42,"name":"Test string","kind":5,"value":1.5,"count":42,"min":1.5,"max":1.5,"stdDev":1.5,"dependencyKind":5,"success":true,"async":true,"dependencySource":5,"commandName":"Test string","dependencyTypeName":"Test string","properties":{"key1":"test value 1","key2":"test value 2"}}'
|
||||
expected = '{"ver":60,"name":"ImFOjAtD","id":"OEyKTSXC","resultCode":"RRBLmlBX","duration":"qsFxgsJU","success":false,"data":"NbtmHjWq","target":"MlNaqxPw","type":"yvCcYRVC","properties":{"dpeP":"BBXyWyVy"},"measurements":{"srjL":0.262}}'
|
||||
assert_equal expected, actual
|
||||
end
|
||||
end
|
||||
|
|
|
@ -10,108 +10,96 @@ class TestRequestData < Test::Unit::TestCase
|
|||
end
|
||||
|
||||
def test_ver_works_as_expected
|
||||
expected = 42
|
||||
expected = 44
|
||||
item = Contracts::RequestData.new
|
||||
item.ver = expected
|
||||
actual = item.ver
|
||||
assert_equal expected, actual
|
||||
expected = 13
|
||||
expected = 53
|
||||
item.ver = expected
|
||||
actual = item.ver
|
||||
assert_equal expected, actual
|
||||
end
|
||||
|
||||
def test_id_works_as_expected
|
||||
expected = 'Test string'
|
||||
expected = 'MgQDgnwj'
|
||||
item = Contracts::RequestData.new
|
||||
item.id = expected
|
||||
actual = item.id
|
||||
assert_equal expected, actual
|
||||
expected = 'Other string'
|
||||
expected = 'ZQLhHKEQ'
|
||||
item.id = expected
|
||||
actual = item.id
|
||||
assert_equal expected, actual
|
||||
end
|
||||
|
||||
def test_source_works_as_expected
|
||||
expected = 'dgIPCOqW'
|
||||
item = Contracts::RequestData.new
|
||||
item.source = expected
|
||||
actual = item.source
|
||||
assert_equal expected, actual
|
||||
expected = 'bNniMOzG'
|
||||
item.source = expected
|
||||
actual = item.source
|
||||
assert_equal expected, actual
|
||||
end
|
||||
|
||||
def test_name_works_as_expected
|
||||
expected = 'Test string'
|
||||
expected = 'IpbmDRHR'
|
||||
item = Contracts::RequestData.new
|
||||
item.name = expected
|
||||
actual = item.name
|
||||
assert_equal expected, actual
|
||||
expected = 'Other string'
|
||||
expected = 'NMfahvIU'
|
||||
item.name = expected
|
||||
actual = item.name
|
||||
assert_equal expected, actual
|
||||
end
|
||||
|
||||
def test_start_time_works_as_expected
|
||||
expected = 'Test string'
|
||||
item = Contracts::RequestData.new
|
||||
item.start_time = expected
|
||||
actual = item.start_time
|
||||
assert_equal expected, actual
|
||||
expected = 'Other string'
|
||||
item.start_time = expected
|
||||
actual = item.start_time
|
||||
assert_equal expected, actual
|
||||
end
|
||||
|
||||
def test_duration_works_as_expected
|
||||
expected = 'Test string'
|
||||
expected = 'pWJMqvrn'
|
||||
item = Contracts::RequestData.new
|
||||
item.duration = expected
|
||||
actual = item.duration
|
||||
assert_equal expected, actual
|
||||
expected = 'Other string'
|
||||
expected = 'sxFglGld'
|
||||
item.duration = expected
|
||||
actual = item.duration
|
||||
assert_equal expected, actual
|
||||
end
|
||||
|
||||
def test_response_code_works_as_expected
|
||||
expected = 'Test string'
|
||||
expected = 'HbsJtlrO'
|
||||
item = Contracts::RequestData.new
|
||||
item.response_code = expected
|
||||
actual = item.response_code
|
||||
assert_equal expected, actual
|
||||
expected = 'Other string'
|
||||
expected = 'owSqbWQM'
|
||||
item.response_code = expected
|
||||
actual = item.response_code
|
||||
assert_equal expected, actual
|
||||
end
|
||||
|
||||
def test_success_works_as_expected
|
||||
expected = true
|
||||
expected = FALSE
|
||||
item = Contracts::RequestData.new
|
||||
item.success = expected
|
||||
actual = item.success
|
||||
assert_equal expected, actual
|
||||
expected = false
|
||||
expected = TRUE
|
||||
item.success = expected
|
||||
actual = item.success
|
||||
assert_equal expected, actual
|
||||
end
|
||||
|
||||
def test_http_method_works_as_expected
|
||||
expected = 'Test string'
|
||||
item = Contracts::RequestData.new
|
||||
item.http_method = expected
|
||||
actual = item.http_method
|
||||
assert_equal expected, actual
|
||||
expected = 'Other string'
|
||||
item.http_method = expected
|
||||
actual = item.http_method
|
||||
assert_equal expected, actual
|
||||
end
|
||||
|
||||
def test_url_works_as_expected
|
||||
expected = 'Test string'
|
||||
expected = 'uZuDIKVi'
|
||||
item = Contracts::RequestData.new
|
||||
item.url = expected
|
||||
actual = item.url
|
||||
assert_equal expected, actual
|
||||
expected = 'Other string'
|
||||
expected = 'IrDHfhEX'
|
||||
item.url = expected
|
||||
actual = item.url
|
||||
assert_equal expected, actual
|
||||
|
@ -131,23 +119,22 @@ class TestRequestData < Test::Unit::TestCase
|
|||
|
||||
def test_to_json_works_as_expected
|
||||
item = Contracts::RequestData.new
|
||||
item.ver = 42
|
||||
item.id = 'Test string'
|
||||
item.name = 'Test string'
|
||||
item.start_time = 'Test string'
|
||||
item.duration = 'Test string'
|
||||
item.response_code = 'Test string'
|
||||
item.success = true
|
||||
item.http_method = 'Test string'
|
||||
item.url = 'Test string'
|
||||
{ 'key1' => 'test value 1' , 'key2' => 'test value 2' }.each do |key, value|
|
||||
item.ver = 44
|
||||
item.id = 'MgQDgnwj'
|
||||
item.source = 'dgIPCOqW'
|
||||
item.name = 'IpbmDRHR'
|
||||
item.duration = 'pWJMqvrn'
|
||||
item.response_code = 'HbsJtlrO'
|
||||
item.success = FALSE
|
||||
item.url = 'uZuDIKVi'
|
||||
{ 'KAbR' => 'LoRanEpP' }.each do |key, value|
|
||||
item.properties[key] = value
|
||||
end
|
||||
{ 'key1' => 3.1415 , 'key2' => 42.2 }.each do |key, value|
|
||||
{ 'GTJR' => 3.9199 }.each do |key, value|
|
||||
item.measurements[key] = value
|
||||
end
|
||||
actual = item.to_json
|
||||
expected = '{"ver":42,"id":"Test string","name":"Test string","startTime":"Test string","duration":"Test string","responseCode":"Test string","success":true,"httpMethod":"Test string","url":"Test string","properties":{"key1":"test value 1","key2":"test value 2"},"measurements":{"key1":3.1415,"key2":42.2}}'
|
||||
expected = '{"ver":44,"id":"MgQDgnwj","source":"dgIPCOqW","name":"IpbmDRHR","duration":"pWJMqvrn","responseCode":"HbsJtlrO","success":false,"url":"uZuDIKVi","properties":{"KAbR":"LoRanEpP"},"measurements":{"GTJR":3.9199}}'
|
||||
assert_equal expected, actual
|
||||
end
|
||||
end
|
||||
|
|
|
@ -10,48 +10,35 @@ class TestSession < Test::Unit::TestCase
|
|||
end
|
||||
|
||||
def test_id_works_as_expected
|
||||
expected = 'Test string'
|
||||
expected = 'loQoJqjW'
|
||||
item = Contracts::Session.new
|
||||
item.id = expected
|
||||
actual = item.id
|
||||
assert_equal expected, actual
|
||||
expected = 'Other string'
|
||||
expected = 'wqzRpTBu'
|
||||
item.id = expected
|
||||
actual = item.id
|
||||
assert_equal expected, actual
|
||||
end
|
||||
|
||||
def test_is_first_works_as_expected
|
||||
expected = 'Test string'
|
||||
expected = 'XoyYwPiz'
|
||||
item = Contracts::Session.new
|
||||
item.is_first = expected
|
||||
actual = item.is_first
|
||||
assert_equal expected, actual
|
||||
expected = 'Other string'
|
||||
expected = 'hZyQkrHb'
|
||||
item.is_first = expected
|
||||
actual = item.is_first
|
||||
assert_equal expected, actual
|
||||
end
|
||||
|
||||
def test_is_new_works_as_expected
|
||||
expected = 'Test string'
|
||||
item = Contracts::Session.new
|
||||
item.is_new = expected
|
||||
actual = item.is_new
|
||||
assert_equal expected, actual
|
||||
expected = 'Other string'
|
||||
item.is_new = expected
|
||||
actual = item.is_new
|
||||
assert_equal expected, actual
|
||||
end
|
||||
|
||||
def test_to_json_works_as_expected
|
||||
item = Contracts::Session.new
|
||||
item.id = 'Test string'
|
||||
item.is_first = 'Test string'
|
||||
item.is_new = 'Test string'
|
||||
item.id = 'loQoJqjW'
|
||||
item.is_first = 'XoyYwPiz'
|
||||
actual = item.to_json
|
||||
expected = '{"ai.session.id":"Test string","ai.session.isFirst":"Test string","ai.session.isNew":"Test string"}'
|
||||
expected = '{"ai.session.id":"loQoJqjW","ai.session.isFirst":"XoyYwPiz"}'
|
||||
assert_equal expected, actual
|
||||
end
|
||||
end
|
||||
|
|
|
@ -10,60 +10,60 @@ class TestStackFrame < Test::Unit::TestCase
|
|||
end
|
||||
|
||||
def test_level_works_as_expected
|
||||
expected = 42
|
||||
expected = 37
|
||||
item = Contracts::StackFrame.new
|
||||
item.level = expected
|
||||
actual = item.level
|
||||
assert_equal expected, actual
|
||||
expected = 13
|
||||
expected = 27
|
||||
item.level = expected
|
||||
actual = item.level
|
||||
assert_equal expected, actual
|
||||
end
|
||||
|
||||
def test_method_works_as_expected
|
||||
expected = 'Test string'
|
||||
expected = 'EkQgDpPN'
|
||||
item = Contracts::StackFrame.new
|
||||
item.method = expected
|
||||
actual = item.method
|
||||
assert_equal expected, actual
|
||||
expected = 'Other string'
|
||||
expected = 'PfRZhlsX'
|
||||
item.method = expected
|
||||
actual = item.method
|
||||
assert_equal expected, actual
|
||||
end
|
||||
|
||||
def test_assembly_works_as_expected
|
||||
expected = 'Test string'
|
||||
expected = 'GxIJFkxm'
|
||||
item = Contracts::StackFrame.new
|
||||
item.assembly = expected
|
||||
actual = item.assembly
|
||||
assert_equal expected, actual
|
||||
expected = 'Other string'
|
||||
expected = 'QYXvOpuB'
|
||||
item.assembly = expected
|
||||
actual = item.assembly
|
||||
assert_equal expected, actual
|
||||
end
|
||||
|
||||
def test_file_name_works_as_expected
|
||||
expected = 'Test string'
|
||||
expected = 'RmInsZZW'
|
||||
item = Contracts::StackFrame.new
|
||||
item.file_name = expected
|
||||
actual = item.file_name
|
||||
assert_equal expected, actual
|
||||
expected = 'Other string'
|
||||
expected = 'nFMPfcAe'
|
||||
item.file_name = expected
|
||||
actual = item.file_name
|
||||
assert_equal expected, actual
|
||||
end
|
||||
|
||||
def test_line_works_as_expected
|
||||
expected = 42
|
||||
expected = 78
|
||||
item = Contracts::StackFrame.new
|
||||
item.line = expected
|
||||
actual = item.line
|
||||
assert_equal expected, actual
|
||||
expected = 13
|
||||
expected = 83
|
||||
item.line = expected
|
||||
actual = item.line
|
||||
assert_equal expected, actual
|
||||
|
@ -71,13 +71,13 @@ class TestStackFrame < Test::Unit::TestCase
|
|||
|
||||
def test_to_json_works_as_expected
|
||||
item = Contracts::StackFrame.new
|
||||
item.level = 42
|
||||
item.method = 'Test string'
|
||||
item.assembly = 'Test string'
|
||||
item.file_name = 'Test string'
|
||||
item.line = 42
|
||||
item.level = 37
|
||||
item.method = 'EkQgDpPN'
|
||||
item.assembly = 'GxIJFkxm'
|
||||
item.file_name = 'RmInsZZW'
|
||||
item.line = 78
|
||||
actual = item.to_json
|
||||
expected = '{"level":42,"method":"Test string","assembly":"Test string","fileName":"Test string","line":42}'
|
||||
expected = '{"level":37,"method":"EkQgDpPN","assembly":"GxIJFkxm","fileName":"RmInsZZW","line":78}'
|
||||
assert_equal expected, actual
|
||||
end
|
||||
end
|
||||
|
|
|
@ -9,88 +9,49 @@ class TestUser < Test::Unit::TestCase
|
|||
assert_not_nil item
|
||||
end
|
||||
|
||||
def test_account_acquisition_date_works_as_expected
|
||||
expected = 'Test string'
|
||||
item = Contracts::User.new
|
||||
item.account_acquisition_date = expected
|
||||
actual = item.account_acquisition_date
|
||||
assert_equal expected, actual
|
||||
expected = 'Other string'
|
||||
item.account_acquisition_date = expected
|
||||
actual = item.account_acquisition_date
|
||||
assert_equal expected, actual
|
||||
end
|
||||
|
||||
def test_account_id_works_as_expected
|
||||
expected = 'Test string'
|
||||
expected = 'KvBXxURr'
|
||||
item = Contracts::User.new
|
||||
item.account_id = expected
|
||||
actual = item.account_id
|
||||
assert_equal expected, actual
|
||||
expected = 'Other string'
|
||||
expected = 'GMHatHCH'
|
||||
item.account_id = expected
|
||||
actual = item.account_id
|
||||
assert_equal expected, actual
|
||||
end
|
||||
|
||||
def test_user_agent_works_as_expected
|
||||
expected = 'Test string'
|
||||
item = Contracts::User.new
|
||||
item.user_agent = expected
|
||||
actual = item.user_agent
|
||||
assert_equal expected, actual
|
||||
expected = 'Other string'
|
||||
item.user_agent = expected
|
||||
actual = item.user_agent
|
||||
assert_equal expected, actual
|
||||
end
|
||||
|
||||
def test_id_works_as_expected
|
||||
expected = 'Test string'
|
||||
expected = 'yqjDGfyE'
|
||||
item = Contracts::User.new
|
||||
item.id = expected
|
||||
actual = item.id
|
||||
assert_equal expected, actual
|
||||
expected = 'Other string'
|
||||
expected = 'rPqqKNPC'
|
||||
item.id = expected
|
||||
actual = item.id
|
||||
assert_equal expected, actual
|
||||
end
|
||||
|
||||
def test_user_auth_id_as_expected
|
||||
expected = 'Test string'
|
||||
def test_auth_user_id_works_as_expected
|
||||
expected = 'VZITGWUe'
|
||||
item = Contracts::User.new
|
||||
item.auth_user_id = expected
|
||||
actual = item.auth_user_id
|
||||
assert_equal expected, actual
|
||||
expected = 'Other string'
|
||||
expected = 'rkrAGTIC'
|
||||
item.auth_user_id = expected
|
||||
actual = item.auth_user_id
|
||||
assert_equal expected, actual
|
||||
end
|
||||
|
||||
def test_store_region_works_as_expected
|
||||
expected = 'Test string'
|
||||
item = Contracts::User.new
|
||||
item.store_region = expected
|
||||
actual = item.store_region
|
||||
assert_equal expected, actual
|
||||
expected = 'Other string'
|
||||
item.store_region = expected
|
||||
actual = item.store_region
|
||||
assert_equal expected, actual
|
||||
end
|
||||
|
||||
def test_to_json_works_as_expected
|
||||
item = Contracts::User.new
|
||||
item.account_acquisition_date = 'Test string'
|
||||
item.account_id = 'Test string'
|
||||
item.user_agent = 'Test string'
|
||||
item.id = 'Test string'
|
||||
item.store_region = 'Test string'
|
||||
item.auth_user_id = 'Test string'
|
||||
item.account_id = 'KvBXxURr'
|
||||
item.id = 'yqjDGfyE'
|
||||
item.auth_user_id = 'VZITGWUe'
|
||||
actual = item.to_json
|
||||
expected = '{"ai.user.accountAcquisitionDate":"Test string","ai.user.accountId":"Test string","ai.user.userAgent":"Test string","ai.user.id":"Test string","ai.user.authUserId":"Test string","ai.user.storeRegion":"Test string"}'
|
||||
expected = '{"ai.user.accountId":"KvBXxURr","ai.user.id":"yqjDGfyE","ai.user.authUserId":"VZITGWUe"}'
|
||||
assert_equal expected, actual
|
||||
end
|
||||
end
|
||||
|
|
Загрузка…
Ссылка в новой задаче