application_insights 0.5.3 → 0.5.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +6 -14
- data/.travis.yml +21 -9
- data/CONTRIBUTING.md +30 -0
- data/Gemfile +4 -4
- data/LICENSE.txt +11 -11
- data/README.md +13 -14
- data/Rakefile +14 -14
- data/application_insights.gemspec +28 -29
- data/lib/application_insights.rb +9 -9
- data/lib/application_insights/channel/asynchronous_queue.rb +58 -51
- data/lib/application_insights/channel/asynchronous_sender.rb +132 -123
- data/lib/application_insights/channel/contracts/application.rb +14 -53
- data/lib/application_insights/channel/contracts/cloud.rb +14 -0
- data/lib/application_insights/channel/contracts/data.rb +14 -48
- data/lib/application_insights/channel/contracts/data_point.rb +24 -130
- data/lib/application_insights/channel/contracts/data_point_type.rb +7 -16
- data/lib/application_insights/channel/contracts/dependency_kind.rb +9 -19
- data/lib/application_insights/channel/contracts/dependency_source_type.rb +9 -19
- data/lib/application_insights/channel/contracts/device.rb +28 -257
- data/lib/application_insights/channel/contracts/envelope.rb +40 -266
- data/lib/application_insights/channel/contracts/event_data.rb +28 -77
- data/lib/application_insights/channel/contracts/exception_data.rb +37 -140
- data/lib/application_insights/channel/contracts/exception_details.rb +28 -129
- data/lib/application_insights/channel/contracts/internal.rb +14 -53
- data/lib/application_insights/channel/contracts/json_serializable.rb +59 -59
- data/lib/application_insights/channel/contracts/location.rb +16 -36
- data/lib/application_insights/channel/contracts/message_data.rb +24 -77
- data/lib/application_insights/channel/contracts/metric_data.rb +27 -60
- data/lib/application_insights/channel/contracts/operation.rb +19 -121
- data/lib/application_insights/channel/contracts/page_view_data.rb +30 -111
- data/lib/application_insights/channel/contracts/remote_dependency_data.rb +56 -260
- data/lib/application_insights/channel/contracts/request_data.rb +36 -176
- data/lib/application_insights/channel/contracts/session.rb +15 -70
- data/lib/application_insights/channel/contracts/severity_level.rb +13 -25
- data/lib/application_insights/channel/contracts/stack_frame.rb +17 -94
- data/lib/application_insights/channel/contracts/user.rb +19 -104
- data/lib/application_insights/channel/event.rb +68 -64
- data/lib/application_insights/channel/queue_base.rb +65 -62
- data/lib/application_insights/channel/sender_base.rb +79 -72
- data/lib/application_insights/channel/synchronous_queue.rb +45 -39
- data/lib/application_insights/channel/synchronous_sender.rb +17 -15
- data/lib/application_insights/channel/telemetry_channel.rb +120 -102
- data/lib/application_insights/channel/telemetry_context.rb +85 -68
- data/lib/application_insights/rack/track_request.rb +87 -84
- data/lib/application_insights/telemetry_client.rb +229 -217
- data/lib/application_insights/unhandled_exception.rb +49 -47
- data/lib/application_insights/version.rb +3 -3
- data/test/application_insights.rb +8 -9
- data/test/application_insights/channel/contracts/test_application.rb +44 -44
- data/test/application_insights/channel/contracts/test_cloud.rb +44 -0
- data/test/application_insights/channel/contracts/test_data.rb +44 -44
- data/test/application_insights/channel/contracts/test_data_point.rb +109 -109
- data/test/application_insights/channel/contracts/test_device.rb +200 -200
- data/test/application_insights/channel/contracts/test_envelope.rb +209 -209
- data/test/application_insights/channel/contracts/test_event_data.rb +62 -62
- data/test/application_insights/channel/contracts/test_exception_data.rb +111 -111
- data/test/application_insights/channel/contracts/test_exception_details.rb +106 -106
- data/test/application_insights/channel/contracts/test_internal.rb +44 -44
- data/test/application_insights/channel/contracts/test_location.rb +70 -31
- data/test/application_insights/channel/contracts/test_message_data.rb +66 -66
- data/test/application_insights/channel/contracts/test_metric_data.rb +50 -50
- data/test/application_insights/channel/contracts/test_operation.rb +109 -96
- data/test/application_insights/channel/contracts/test_page_view_data.rb +88 -88
- data/test/application_insights/channel/contracts/test_remote_dependency_data.rb +209 -209
- data/test/application_insights/channel/contracts/test_request_data.rb +153 -153
- data/test/application_insights/channel/contracts/test_session.rb +57 -57
- data/test/application_insights/channel/contracts/test_stack_frame.rb +83 -83
- data/test/application_insights/channel/contracts/test_user.rb +96 -83
- data/test/application_insights/channel/test_asynchronous_queue.rb +47 -47
- data/test/application_insights/channel/test_asynchronous_sender.rb +80 -80
- data/test/application_insights/channel/test_event.rb +52 -52
- data/test/application_insights/channel/test_queue_base.rb +88 -88
- data/test/application_insights/channel/test_sender_base.rb +87 -87
- data/test/application_insights/channel/test_synchronous_queue.rb +27 -27
- data/test/application_insights/channel/test_synchronous_sender.rb +10 -10
- data/test/application_insights/channel/test_telemetry_channel.rb +126 -102
- data/test/application_insights/channel/test_telemetry_context.rb +82 -74
- data/test/application_insights/mock_sender.rb +37 -37
- data/test/application_insights/rack/test_track_request.rb +142 -139
- data/test/application_insights/test_telemetry_client.rb +133 -123
- data/test/application_insights/test_unhandled_exception.rb +23 -24
- metadata +23 -33
@@ -1,153 +1,153 @@
|
|
1
|
-
require_relative '../../../../lib/application_insights/channel/contracts/request_data'
|
2
|
-
require 'test/unit'
|
3
|
-
|
4
|
-
include ApplicationInsights::Channel
|
5
|
-
|
6
|
-
class TestRequestData < Test::Unit::TestCase
|
7
|
-
def test_initialize
|
8
|
-
item = Contracts::RequestData.new
|
9
|
-
assert_not_nil item
|
10
|
-
end
|
11
|
-
|
12
|
-
def test_ver_works_as_expected
|
13
|
-
expected = 42
|
14
|
-
item = Contracts::RequestData.new
|
15
|
-
item.ver = expected
|
16
|
-
actual = item.ver
|
17
|
-
assert_equal expected, actual
|
18
|
-
expected = 13
|
19
|
-
item.ver = expected
|
20
|
-
actual = item.ver
|
21
|
-
assert_equal expected, actual
|
22
|
-
end
|
23
|
-
|
24
|
-
def test_id_works_as_expected
|
25
|
-
expected = 'Test string'
|
26
|
-
item = Contracts::RequestData.new
|
27
|
-
item.id = expected
|
28
|
-
actual = item.id
|
29
|
-
assert_equal expected, actual
|
30
|
-
expected = 'Other string'
|
31
|
-
item.id = expected
|
32
|
-
actual = item.id
|
33
|
-
assert_equal expected, actual
|
34
|
-
end
|
35
|
-
|
36
|
-
def test_name_works_as_expected
|
37
|
-
expected = 'Test string'
|
38
|
-
item = Contracts::RequestData.new
|
39
|
-
item.name = expected
|
40
|
-
actual = item.name
|
41
|
-
assert_equal expected, actual
|
42
|
-
expected = 'Other string'
|
43
|
-
item.name = expected
|
44
|
-
actual = item.name
|
45
|
-
assert_equal expected, actual
|
46
|
-
end
|
47
|
-
|
48
|
-
def test_start_time_works_as_expected
|
49
|
-
expected = 'Test string'
|
50
|
-
item = Contracts::RequestData.new
|
51
|
-
item.start_time = expected
|
52
|
-
actual = item.start_time
|
53
|
-
assert_equal expected, actual
|
54
|
-
expected = 'Other string'
|
55
|
-
item.start_time = expected
|
56
|
-
actual = item.start_time
|
57
|
-
assert_equal expected, actual
|
58
|
-
end
|
59
|
-
|
60
|
-
def test_duration_works_as_expected
|
61
|
-
expected = 'Test string'
|
62
|
-
item = Contracts::RequestData.new
|
63
|
-
item.duration = expected
|
64
|
-
actual = item.duration
|
65
|
-
assert_equal expected, actual
|
66
|
-
expected = 'Other string'
|
67
|
-
item.duration = expected
|
68
|
-
actual = item.duration
|
69
|
-
assert_equal expected, actual
|
70
|
-
end
|
71
|
-
|
72
|
-
def test_response_code_works_as_expected
|
73
|
-
expected = 'Test string'
|
74
|
-
item = Contracts::RequestData.new
|
75
|
-
item.response_code = expected
|
76
|
-
actual = item.response_code
|
77
|
-
assert_equal expected, actual
|
78
|
-
expected = 'Other string'
|
79
|
-
item.response_code = expected
|
80
|
-
actual = item.response_code
|
81
|
-
assert_equal expected, actual
|
82
|
-
end
|
83
|
-
|
84
|
-
def test_success_works_as_expected
|
85
|
-
expected =
|
86
|
-
item = Contracts::RequestData.new
|
87
|
-
item.success = expected
|
88
|
-
actual = item.success
|
89
|
-
assert_equal expected, actual
|
90
|
-
expected =
|
91
|
-
item.success = expected
|
92
|
-
actual = item.success
|
93
|
-
assert_equal expected, actual
|
94
|
-
end
|
95
|
-
|
96
|
-
def test_http_method_works_as_expected
|
97
|
-
expected = 'Test string'
|
98
|
-
item = Contracts::RequestData.new
|
99
|
-
item.http_method = expected
|
100
|
-
actual = item.http_method
|
101
|
-
assert_equal expected, actual
|
102
|
-
expected = 'Other string'
|
103
|
-
item.http_method = expected
|
104
|
-
actual = item.http_method
|
105
|
-
assert_equal expected, actual
|
106
|
-
end
|
107
|
-
|
108
|
-
def test_url_works_as_expected
|
109
|
-
expected = 'Test string'
|
110
|
-
item = Contracts::RequestData.new
|
111
|
-
item.url = expected
|
112
|
-
actual = item.url
|
113
|
-
assert_equal expected, actual
|
114
|
-
expected = 'Other string'
|
115
|
-
item.url = expected
|
116
|
-
actual = item.url
|
117
|
-
assert_equal expected, actual
|
118
|
-
end
|
119
|
-
|
120
|
-
def test_properties_works_as_expected
|
121
|
-
item = Contracts::RequestData.new
|
122
|
-
actual = item.properties
|
123
|
-
assert_not_nil actual
|
124
|
-
end
|
125
|
-
|
126
|
-
def test_measurements_works_as_expected
|
127
|
-
item = Contracts::RequestData.new
|
128
|
-
actual = item.measurements
|
129
|
-
assert_not_nil actual
|
130
|
-
end
|
131
|
-
|
132
|
-
def test_to_json_works_as_expected
|
133
|
-
item = Contracts::RequestData.new
|
134
|
-
item.ver = 42
|
135
|
-
item.id = 'Test string'
|
136
|
-
item.name = 'Test string'
|
137
|
-
item.start_time = 'Test string'
|
138
|
-
item.duration = 'Test string'
|
139
|
-
item.response_code = 'Test string'
|
140
|
-
item.success =
|
141
|
-
item.http_method = 'Test string'
|
142
|
-
item.url = 'Test string'
|
143
|
-
{ 'key1' => 'test value 1' , 'key2' => 'test value 2' }.each do |key, value|
|
144
|
-
item.properties[key] = value
|
145
|
-
end
|
146
|
-
{ 'key1' => 3.1415 , 'key2' => 42.2 }.each do |key, value|
|
147
|
-
item.measurements[key] = value
|
148
|
-
end
|
149
|
-
actual = item.to_json
|
150
|
-
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}}'
|
151
|
-
assert_equal expected, actual
|
152
|
-
end
|
153
|
-
end
|
1
|
+
require_relative '../../../../lib/application_insights/channel/contracts/request_data'
|
2
|
+
require 'test/unit'
|
3
|
+
|
4
|
+
include ApplicationInsights::Channel
|
5
|
+
|
6
|
+
class TestRequestData < Test::Unit::TestCase
|
7
|
+
def test_initialize
|
8
|
+
item = Contracts::RequestData.new
|
9
|
+
assert_not_nil item
|
10
|
+
end
|
11
|
+
|
12
|
+
def test_ver_works_as_expected
|
13
|
+
expected = 42
|
14
|
+
item = Contracts::RequestData.new
|
15
|
+
item.ver = expected
|
16
|
+
actual = item.ver
|
17
|
+
assert_equal expected, actual
|
18
|
+
expected = 13
|
19
|
+
item.ver = expected
|
20
|
+
actual = item.ver
|
21
|
+
assert_equal expected, actual
|
22
|
+
end
|
23
|
+
|
24
|
+
def test_id_works_as_expected
|
25
|
+
expected = 'Test string'
|
26
|
+
item = Contracts::RequestData.new
|
27
|
+
item.id = expected
|
28
|
+
actual = item.id
|
29
|
+
assert_equal expected, actual
|
30
|
+
expected = 'Other string'
|
31
|
+
item.id = expected
|
32
|
+
actual = item.id
|
33
|
+
assert_equal expected, actual
|
34
|
+
end
|
35
|
+
|
36
|
+
def test_name_works_as_expected
|
37
|
+
expected = 'Test string'
|
38
|
+
item = Contracts::RequestData.new
|
39
|
+
item.name = expected
|
40
|
+
actual = item.name
|
41
|
+
assert_equal expected, actual
|
42
|
+
expected = 'Other string'
|
43
|
+
item.name = expected
|
44
|
+
actual = item.name
|
45
|
+
assert_equal expected, actual
|
46
|
+
end
|
47
|
+
|
48
|
+
def test_start_time_works_as_expected
|
49
|
+
expected = 'Test string'
|
50
|
+
item = Contracts::RequestData.new
|
51
|
+
item.start_time = expected
|
52
|
+
actual = item.start_time
|
53
|
+
assert_equal expected, actual
|
54
|
+
expected = 'Other string'
|
55
|
+
item.start_time = expected
|
56
|
+
actual = item.start_time
|
57
|
+
assert_equal expected, actual
|
58
|
+
end
|
59
|
+
|
60
|
+
def test_duration_works_as_expected
|
61
|
+
expected = 'Test string'
|
62
|
+
item = Contracts::RequestData.new
|
63
|
+
item.duration = expected
|
64
|
+
actual = item.duration
|
65
|
+
assert_equal expected, actual
|
66
|
+
expected = 'Other string'
|
67
|
+
item.duration = expected
|
68
|
+
actual = item.duration
|
69
|
+
assert_equal expected, actual
|
70
|
+
end
|
71
|
+
|
72
|
+
def test_response_code_works_as_expected
|
73
|
+
expected = 'Test string'
|
74
|
+
item = Contracts::RequestData.new
|
75
|
+
item.response_code = expected
|
76
|
+
actual = item.response_code
|
77
|
+
assert_equal expected, actual
|
78
|
+
expected = 'Other string'
|
79
|
+
item.response_code = expected
|
80
|
+
actual = item.response_code
|
81
|
+
assert_equal expected, actual
|
82
|
+
end
|
83
|
+
|
84
|
+
def test_success_works_as_expected
|
85
|
+
expected = true
|
86
|
+
item = Contracts::RequestData.new
|
87
|
+
item.success = expected
|
88
|
+
actual = item.success
|
89
|
+
assert_equal expected, actual
|
90
|
+
expected = false
|
91
|
+
item.success = expected
|
92
|
+
actual = item.success
|
93
|
+
assert_equal expected, actual
|
94
|
+
end
|
95
|
+
|
96
|
+
def test_http_method_works_as_expected
|
97
|
+
expected = 'Test string'
|
98
|
+
item = Contracts::RequestData.new
|
99
|
+
item.http_method = expected
|
100
|
+
actual = item.http_method
|
101
|
+
assert_equal expected, actual
|
102
|
+
expected = 'Other string'
|
103
|
+
item.http_method = expected
|
104
|
+
actual = item.http_method
|
105
|
+
assert_equal expected, actual
|
106
|
+
end
|
107
|
+
|
108
|
+
def test_url_works_as_expected
|
109
|
+
expected = 'Test string'
|
110
|
+
item = Contracts::RequestData.new
|
111
|
+
item.url = expected
|
112
|
+
actual = item.url
|
113
|
+
assert_equal expected, actual
|
114
|
+
expected = 'Other string'
|
115
|
+
item.url = expected
|
116
|
+
actual = item.url
|
117
|
+
assert_equal expected, actual
|
118
|
+
end
|
119
|
+
|
120
|
+
def test_properties_works_as_expected
|
121
|
+
item = Contracts::RequestData.new
|
122
|
+
actual = item.properties
|
123
|
+
assert_not_nil actual
|
124
|
+
end
|
125
|
+
|
126
|
+
def test_measurements_works_as_expected
|
127
|
+
item = Contracts::RequestData.new
|
128
|
+
actual = item.measurements
|
129
|
+
assert_not_nil actual
|
130
|
+
end
|
131
|
+
|
132
|
+
def test_to_json_works_as_expected
|
133
|
+
item = Contracts::RequestData.new
|
134
|
+
item.ver = 42
|
135
|
+
item.id = 'Test string'
|
136
|
+
item.name = 'Test string'
|
137
|
+
item.start_time = 'Test string'
|
138
|
+
item.duration = 'Test string'
|
139
|
+
item.response_code = 'Test string'
|
140
|
+
item.success = true
|
141
|
+
item.http_method = 'Test string'
|
142
|
+
item.url = 'Test string'
|
143
|
+
{ 'key1' => 'test value 1' , 'key2' => 'test value 2' }.each do |key, value|
|
144
|
+
item.properties[key] = value
|
145
|
+
end
|
146
|
+
{ 'key1' => 3.1415 , 'key2' => 42.2 }.each do |key, value|
|
147
|
+
item.measurements[key] = value
|
148
|
+
end
|
149
|
+
actual = item.to_json
|
150
|
+
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}}'
|
151
|
+
assert_equal expected, actual
|
152
|
+
end
|
153
|
+
end
|
@@ -1,57 +1,57 @@
|
|
1
|
-
require_relative '../../../../lib/application_insights/channel/contracts/session'
|
2
|
-
require 'test/unit'
|
3
|
-
|
4
|
-
include ApplicationInsights::Channel
|
5
|
-
|
6
|
-
class TestSession < Test::Unit::TestCase
|
7
|
-
def test_initialize
|
8
|
-
item = Contracts::Session.new
|
9
|
-
assert_not_nil item
|
10
|
-
end
|
11
|
-
|
12
|
-
def test_id_works_as_expected
|
13
|
-
expected = 'Test string'
|
14
|
-
item = Contracts::Session.new
|
15
|
-
item.id = expected
|
16
|
-
actual = item.id
|
17
|
-
assert_equal expected, actual
|
18
|
-
expected = 'Other string'
|
19
|
-
item.id = expected
|
20
|
-
actual = item.id
|
21
|
-
assert_equal expected, actual
|
22
|
-
end
|
23
|
-
|
24
|
-
def test_is_first_works_as_expected
|
25
|
-
expected = 'Test string'
|
26
|
-
item = Contracts::Session.new
|
27
|
-
item.is_first = expected
|
28
|
-
actual = item.is_first
|
29
|
-
assert_equal expected, actual
|
30
|
-
expected = 'Other string'
|
31
|
-
item.is_first = expected
|
32
|
-
actual = item.is_first
|
33
|
-
assert_equal expected, actual
|
34
|
-
end
|
35
|
-
|
36
|
-
def test_is_new_works_as_expected
|
37
|
-
expected = 'Test string'
|
38
|
-
item = Contracts::Session.new
|
39
|
-
item.is_new = expected
|
40
|
-
actual = item.is_new
|
41
|
-
assert_equal expected, actual
|
42
|
-
expected = 'Other string'
|
43
|
-
item.is_new = expected
|
44
|
-
actual = item.is_new
|
45
|
-
assert_equal expected, actual
|
46
|
-
end
|
47
|
-
|
48
|
-
def test_to_json_works_as_expected
|
49
|
-
item = Contracts::Session.new
|
50
|
-
item.id = 'Test string'
|
51
|
-
item.is_first = 'Test string'
|
52
|
-
item.is_new = 'Test string'
|
53
|
-
actual = item.to_json
|
54
|
-
expected = '{"ai.session.id":"Test string","ai.session.isFirst":"Test string","ai.session.isNew":"Test string"}'
|
55
|
-
assert_equal expected, actual
|
56
|
-
end
|
57
|
-
end
|
1
|
+
require_relative '../../../../lib/application_insights/channel/contracts/session'
|
2
|
+
require 'test/unit'
|
3
|
+
|
4
|
+
include ApplicationInsights::Channel
|
5
|
+
|
6
|
+
class TestSession < Test::Unit::TestCase
|
7
|
+
def test_initialize
|
8
|
+
item = Contracts::Session.new
|
9
|
+
assert_not_nil item
|
10
|
+
end
|
11
|
+
|
12
|
+
def test_id_works_as_expected
|
13
|
+
expected = 'Test string'
|
14
|
+
item = Contracts::Session.new
|
15
|
+
item.id = expected
|
16
|
+
actual = item.id
|
17
|
+
assert_equal expected, actual
|
18
|
+
expected = 'Other string'
|
19
|
+
item.id = expected
|
20
|
+
actual = item.id
|
21
|
+
assert_equal expected, actual
|
22
|
+
end
|
23
|
+
|
24
|
+
def test_is_first_works_as_expected
|
25
|
+
expected = 'Test string'
|
26
|
+
item = Contracts::Session.new
|
27
|
+
item.is_first = expected
|
28
|
+
actual = item.is_first
|
29
|
+
assert_equal expected, actual
|
30
|
+
expected = 'Other string'
|
31
|
+
item.is_first = expected
|
32
|
+
actual = item.is_first
|
33
|
+
assert_equal expected, actual
|
34
|
+
end
|
35
|
+
|
36
|
+
def test_is_new_works_as_expected
|
37
|
+
expected = 'Test string'
|
38
|
+
item = Contracts::Session.new
|
39
|
+
item.is_new = expected
|
40
|
+
actual = item.is_new
|
41
|
+
assert_equal expected, actual
|
42
|
+
expected = 'Other string'
|
43
|
+
item.is_new = expected
|
44
|
+
actual = item.is_new
|
45
|
+
assert_equal expected, actual
|
46
|
+
end
|
47
|
+
|
48
|
+
def test_to_json_works_as_expected
|
49
|
+
item = Contracts::Session.new
|
50
|
+
item.id = 'Test string'
|
51
|
+
item.is_first = 'Test string'
|
52
|
+
item.is_new = 'Test string'
|
53
|
+
actual = item.to_json
|
54
|
+
expected = '{"ai.session.id":"Test string","ai.session.isFirst":"Test string","ai.session.isNew":"Test string"}'
|
55
|
+
assert_equal expected, actual
|
56
|
+
end
|
57
|
+
end
|
@@ -1,83 +1,83 @@
|
|
1
|
-
require_relative '../../../../lib/application_insights/channel/contracts/stack_frame'
|
2
|
-
require 'test/unit'
|
3
|
-
|
4
|
-
include ApplicationInsights::Channel
|
5
|
-
|
6
|
-
class TestStackFrame < Test::Unit::TestCase
|
7
|
-
def test_initialize
|
8
|
-
item = Contracts::StackFrame.new
|
9
|
-
assert_not_nil item
|
10
|
-
end
|
11
|
-
|
12
|
-
def test_level_works_as_expected
|
13
|
-
expected = 42
|
14
|
-
item = Contracts::StackFrame.new
|
15
|
-
item.level = expected
|
16
|
-
actual = item.level
|
17
|
-
assert_equal expected, actual
|
18
|
-
expected = 13
|
19
|
-
item.level = expected
|
20
|
-
actual = item.level
|
21
|
-
assert_equal expected, actual
|
22
|
-
end
|
23
|
-
|
24
|
-
def test_method_works_as_expected
|
25
|
-
expected = 'Test string'
|
26
|
-
item = Contracts::StackFrame.new
|
27
|
-
item.method = expected
|
28
|
-
actual = item.method
|
29
|
-
assert_equal expected, actual
|
30
|
-
expected = 'Other string'
|
31
|
-
item.method = expected
|
32
|
-
actual = item.method
|
33
|
-
assert_equal expected, actual
|
34
|
-
end
|
35
|
-
|
36
|
-
def test_assembly_works_as_expected
|
37
|
-
expected = 'Test string'
|
38
|
-
item = Contracts::StackFrame.new
|
39
|
-
item.assembly = expected
|
40
|
-
actual = item.assembly
|
41
|
-
assert_equal expected, actual
|
42
|
-
expected = 'Other string'
|
43
|
-
item.assembly = expected
|
44
|
-
actual = item.assembly
|
45
|
-
assert_equal expected, actual
|
46
|
-
end
|
47
|
-
|
48
|
-
def test_file_name_works_as_expected
|
49
|
-
expected = 'Test string'
|
50
|
-
item = Contracts::StackFrame.new
|
51
|
-
item.file_name = expected
|
52
|
-
actual = item.file_name
|
53
|
-
assert_equal expected, actual
|
54
|
-
expected = 'Other string'
|
55
|
-
item.file_name = expected
|
56
|
-
actual = item.file_name
|
57
|
-
assert_equal expected, actual
|
58
|
-
end
|
59
|
-
|
60
|
-
def test_line_works_as_expected
|
61
|
-
expected = 42
|
62
|
-
item = Contracts::StackFrame.new
|
63
|
-
item.line = expected
|
64
|
-
actual = item.line
|
65
|
-
assert_equal expected, actual
|
66
|
-
expected = 13
|
67
|
-
item.line = expected
|
68
|
-
actual = item.line
|
69
|
-
assert_equal expected, actual
|
70
|
-
end
|
71
|
-
|
72
|
-
def test_to_json_works_as_expected
|
73
|
-
item = Contracts::StackFrame.new
|
74
|
-
item.level = 42
|
75
|
-
item.method = 'Test string'
|
76
|
-
item.assembly = 'Test string'
|
77
|
-
item.file_name = 'Test string'
|
78
|
-
item.line = 42
|
79
|
-
actual = item.to_json
|
80
|
-
expected = '{"level":42,"method":"Test string","assembly":"Test string","fileName":"Test string","line":42}'
|
81
|
-
assert_equal expected, actual
|
82
|
-
end
|
83
|
-
end
|
1
|
+
require_relative '../../../../lib/application_insights/channel/contracts/stack_frame'
|
2
|
+
require 'test/unit'
|
3
|
+
|
4
|
+
include ApplicationInsights::Channel
|
5
|
+
|
6
|
+
class TestStackFrame < Test::Unit::TestCase
|
7
|
+
def test_initialize
|
8
|
+
item = Contracts::StackFrame.new
|
9
|
+
assert_not_nil item
|
10
|
+
end
|
11
|
+
|
12
|
+
def test_level_works_as_expected
|
13
|
+
expected = 42
|
14
|
+
item = Contracts::StackFrame.new
|
15
|
+
item.level = expected
|
16
|
+
actual = item.level
|
17
|
+
assert_equal expected, actual
|
18
|
+
expected = 13
|
19
|
+
item.level = expected
|
20
|
+
actual = item.level
|
21
|
+
assert_equal expected, actual
|
22
|
+
end
|
23
|
+
|
24
|
+
def test_method_works_as_expected
|
25
|
+
expected = 'Test string'
|
26
|
+
item = Contracts::StackFrame.new
|
27
|
+
item.method = expected
|
28
|
+
actual = item.method
|
29
|
+
assert_equal expected, actual
|
30
|
+
expected = 'Other string'
|
31
|
+
item.method = expected
|
32
|
+
actual = item.method
|
33
|
+
assert_equal expected, actual
|
34
|
+
end
|
35
|
+
|
36
|
+
def test_assembly_works_as_expected
|
37
|
+
expected = 'Test string'
|
38
|
+
item = Contracts::StackFrame.new
|
39
|
+
item.assembly = expected
|
40
|
+
actual = item.assembly
|
41
|
+
assert_equal expected, actual
|
42
|
+
expected = 'Other string'
|
43
|
+
item.assembly = expected
|
44
|
+
actual = item.assembly
|
45
|
+
assert_equal expected, actual
|
46
|
+
end
|
47
|
+
|
48
|
+
def test_file_name_works_as_expected
|
49
|
+
expected = 'Test string'
|
50
|
+
item = Contracts::StackFrame.new
|
51
|
+
item.file_name = expected
|
52
|
+
actual = item.file_name
|
53
|
+
assert_equal expected, actual
|
54
|
+
expected = 'Other string'
|
55
|
+
item.file_name = expected
|
56
|
+
actual = item.file_name
|
57
|
+
assert_equal expected, actual
|
58
|
+
end
|
59
|
+
|
60
|
+
def test_line_works_as_expected
|
61
|
+
expected = 42
|
62
|
+
item = Contracts::StackFrame.new
|
63
|
+
item.line = expected
|
64
|
+
actual = item.line
|
65
|
+
assert_equal expected, actual
|
66
|
+
expected = 13
|
67
|
+
item.line = expected
|
68
|
+
actual = item.line
|
69
|
+
assert_equal expected, actual
|
70
|
+
end
|
71
|
+
|
72
|
+
def test_to_json_works_as_expected
|
73
|
+
item = Contracts::StackFrame.new
|
74
|
+
item.level = 42
|
75
|
+
item.method = 'Test string'
|
76
|
+
item.assembly = 'Test string'
|
77
|
+
item.file_name = 'Test string'
|
78
|
+
item.line = 42
|
79
|
+
actual = item.to_json
|
80
|
+
expected = '{"level":42,"method":"Test string","assembly":"Test string","fileName":"Test string","line":42}'
|
81
|
+
assert_equal expected, actual
|
82
|
+
end
|
83
|
+
end
|