Skip to content

Commit 10c0b16

Browse files
committed
Added documentation headers
1 parent 33aed9f commit 10c0b16

File tree

5 files changed

+85
-3
lines changed

5 files changed

+85
-3
lines changed

FirebaseAdmin/FirebaseAdmin.Tests/Messaging/FcmOptionsTest.cs

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,17 @@
1+
// Copyright 2019, Google Inc. All rights reserved.
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
115
using System;
216
using FirebaseAdmin.Messaging;
317
using FirebaseAdmin.Messaging.Util;
@@ -35,13 +49,20 @@ public void AndroidFcmOptionsCopyAndValidate()
3549
public void FcmOptionsCopyAndValidateNullLabel()
3650
{
3751
var options = new FcmOptions() { AnalyticsLabel = null };
52+
options.CopyAndValidate();
53+
}
54+
55+
[Fact]
56+
public void FcmOptionsCopyAndValidateEmptyLabel()
57+
{
58+
var options = new FcmOptions() { AnalyticsLabel = string.Empty };
3859
Assert.Throws<ArgumentException>(() => options.CopyAndValidate());
3960
}
4061

4162
[Fact]
4263
public void AnalyticsLabelTooLong()
4364
{
44-
Assert.Throws<ArgumentException>(() => AnalyticsLabelChecker.ValidateAnalyticsLabel("012345678901234567890123456789012345678901234567890"));
65+
Assert.Throws<ArgumentException>(() => AnalyticsLabelChecker.ValidateAnalyticsLabel(new string('a', 51)));
4566
}
4667

4768
[Fact]
@@ -56,4 +77,4 @@ public void AnalyticsLabelInvalidCharacters()
5677
Assert.Throws<ArgumentException>(() => AnalyticsLabelChecker.ValidateAnalyticsLabel("label(label)"));
5778
}
5879
}
59-
}
80+
}

FirebaseAdmin/FirebaseAdmin/Messaging/AndroidFcmOptions.cs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,17 @@
1+
// Copyright 2019, Google Inc. All rights reserved.
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
115
using FirebaseAdmin.Messaging.Util;
216
using Newtonsoft.Json;
317

FirebaseAdmin/FirebaseAdmin/Messaging/ApnsFcmOptions.cs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,17 @@
1+
// Copyright 2019, Google Inc. All rights reserved.
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
115
using FirebaseAdmin.Messaging.Util;
216
using Newtonsoft.Json;
317

FirebaseAdmin/FirebaseAdmin/Messaging/FcmOptions.cs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,17 @@
1+
// Copyright 2019, Google Inc. All rights reserved.
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
115
using FirebaseAdmin.Messaging.Util;
216
using Newtonsoft.Json;
317

FirebaseAdmin/FirebaseAdmin/Messaging/Util/AnalyticsLabelChecker.cs

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,17 @@
1+
// Copyright 2019, Google Inc. All rights reserved.
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
115
using System;
216
using System.Text.RegularExpressions;
317

@@ -17,7 +31,12 @@ internal static class AnalyticsLabelChecker
1731
/// <param name="analyticsLabel">Analytics label.</param>
1832
public static void ValidateAnalyticsLabel(string analyticsLabel)
1933
{
20-
if (string.IsNullOrWhiteSpace(analyticsLabel))
34+
if (analyticsLabel == null)
35+
{
36+
return;
37+
}
38+
39+
if (analyticsLabel == string.Empty)
2140
{
2241
throw new ArgumentException("Analytics label must have format matching'^[a-zA-Z0-9-_.~%]{1,50}$");
2342
}

0 commit comments

Comments
 (0)