Skip to content

Commit 3d81bc9

Browse files
authored
chore: Prepare 2.2.2 release (#133)
1 parent 4b9e01d commit 3d81bc9

File tree

10 files changed

+318
-22
lines changed

10 files changed

+318
-22
lines changed

CHANGELOG.md

+5
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
## 2.2.2
2+
January 31, 2019
3+
### Bug fixes
4+
* fix(eventtagsutils) : fixes bug where values of 0 and 1 are excluded from the event value in the conversion event payload. ([#132](https://github.com/optimizely/csharp-sdk/pull/132))
5+
16
## 2.2.1
27
November 1, 2018
38
### Bug fixes

OptimizelySDK.DemoApp/Properties/AssemblyInfo.cs

+3-3
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,6 @@
3737
//
3838
// You can specify all the values or you can default the Revision and Build Numbers
3939
// by using the '*' as shown below:
40-
[assembly: AssemblyVersion("2.2.1.0")]
41-
[assembly: AssemblyFileVersion("2.2.1.0")]
42-
[assembly: AssemblyInformationalVersion("2.2.1")] // Used by Nuget.
40+
[assembly: AssemblyVersion("2.2.2.0")]
41+
[assembly: AssemblyFileVersion("2.2.2.0")]
42+
[assembly: AssemblyInformationalVersion("2.2.2")] // Used by Nuget.

OptimizelySDK.Net35/Properties/AssemblyInfo.cs

+3-3
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,6 @@
3838
// You can specify all the values or you can default the Build and Revision Numbers
3939
// by using the '*' as shown below:
4040
// [assembly: AssemblyVersion("1.0.*")]
41-
[assembly: AssemblyVersion("2.2.1.0")]
42-
[assembly: AssemblyFileVersion("2.2.1.0")]
43-
[assembly: AssemblyInformationalVersion("2.2.1")] // Used by Nuget.
41+
[assembly: AssemblyVersion("2.2.2.0")]
42+
[assembly: AssemblyFileVersion("2.2.2.0")]
43+
[assembly: AssemblyInformationalVersion("2.2.2")] // Used by Nuget.

OptimizelySDK.Net40/Properties/AssemblyInfo.cs

+3-3
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,6 @@
3838
// You can specify all the values or you can default the Build and Revision Numbers
3939
// by using the '*' as shown below:
4040
// [assembly: AssemblyVersion("1.0.*")]
41-
[assembly: AssemblyVersion("2.2.1.0")]
42-
[assembly: AssemblyFileVersion("2.2.1.0")]
43-
[assembly: AssemblyInformationalVersion("2.2.1")] // Used by Nuget.
41+
[assembly: AssemblyVersion("2.2.2.0")]
42+
[assembly: AssemblyFileVersion("2.2.2.0")]
43+
[assembly: AssemblyInformationalVersion("2.2.2")] // Used by Nuget.

OptimizelySDK.Package/OptimizelySDK.nuspec

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<package>
33
<metadata>
44
<id>Optimizely.SDK</id>
5-
<version>2.2.1</version>
5+
<version>2.2.2</version>
66
<title>Optimizely C# SDK</title>
77
<authors>Optimizely Development Team</authors>
88
<owners>fullstack.optimizely</owners>

OptimizelySDK.Package/verifysn.ps1

+2-2
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ if ($PSVersionTable["Platform"] -eq "Unix") {
1818
# Locate *.nupkg
1919
################################################################
2020
Write-Host "Locate *.nupkg"
21-
# Good enough for 2.2.1
22-
$nupkg="./Optimizely.SDK.2.2.1.nupkg"
21+
# Good enough for 2.2.2
22+
$nupkg="./Optimizely.SDK.2.2.2.nupkg"
2323

2424
################################################################
2525
# Unzipping *.nupkg

OptimizelySDK.Tests/EventTests/EventBuilderTest.cs

+291
Original file line numberDiff line numberDiff line change
@@ -1016,6 +1016,297 @@ public void TestConversionEventWithNumericTag()
10161016
Assert.IsTrue(TestData.CompareObjects(expectedEvent, logEvent));
10171017
}
10181018

1019+
[Test]
1020+
public void TestConversionEventWithFalsyNumericAndRevenueValues()
1021+
{
1022+
var guid = Guid.NewGuid();
1023+
var timeStamp = TestData.SecondsSince1970();
1024+
var payloadParams = new Dictionary<string, object>
1025+
{
1026+
{ "visitors", new object[]
1027+
{
1028+
new Dictionary<string, object>()
1029+
{
1030+
{ "snapshots", new object[]
1031+
{
1032+
new Dictionary<string, object>
1033+
{
1034+
{ "decisions", new object[]
1035+
{
1036+
new Dictionary<string, object>
1037+
{
1038+
{"campaign_id", "7719770039" },
1039+
{"experiment_id", "7716830082" },
1040+
{"variation_id", "7722370027" }
1041+
}
1042+
}
1043+
},
1044+
{ "events", new object[]
1045+
{
1046+
new Dictionary<string, object>
1047+
{
1048+
{"entity_id", "7718020063" },
1049+
{"timestamp", timeStamp },
1050+
{"uuid", guid },
1051+
{"key", "purchase" },
1052+
{"revenue", 0 },
1053+
{"value", 0.0 },
1054+
{"tags",
1055+
new Dictionary<string, object>
1056+
{
1057+
{"revenue", 0 },
1058+
{"value", 0.0 }
1059+
}
1060+
}
1061+
}
1062+
}
1063+
}
1064+
}
1065+
}
1066+
},
1067+
{ "attributes", new object[]
1068+
{
1069+
new Dictionary<string, object>
1070+
{
1071+
{"entity_id", ControlAttributes.BOT_FILTERING_ATTRIBUTE},
1072+
{"key", ControlAttributes.BOT_FILTERING_ATTRIBUTE},
1073+
{"type", "custom" },
1074+
{"value", true }
1075+
}
1076+
}
1077+
},
1078+
{ "visitor_id", TestUserId }
1079+
}
1080+
}
1081+
},
1082+
{"project_id", "7720880029" },
1083+
{"account_id", "1592310167" },
1084+
{"client_name", "csharp-sdk" },
1085+
{"client_version", Optimizely.SDK_VERSION },
1086+
{"revision", "15" },
1087+
{"anonymize_ip", false}
1088+
};
1089+
1090+
var expectedEvent = new LogEvent(
1091+
"https://logx.optimizely.com/v1/events",
1092+
payloadParams,
1093+
"POST",
1094+
new Dictionary<string, string>
1095+
{
1096+
{ "Content-Type", "application/json"}
1097+
});
1098+
1099+
var experimentToVariationMap = new Dictionary<string, Variation>
1100+
{
1101+
{"7716830082", new Variation{Id="7722370027", Key="control"} }
1102+
};
1103+
1104+
var logEvent = EventBuilder.CreateConversionEvent(Config, "purchase", experimentToVariationMap, TestUserId, null,
1105+
new EventTags
1106+
{
1107+
{"revenue", 0 },
1108+
{"value", 0.0 }
1109+
});
1110+
1111+
TestData.ChangeGUIDAndTimeStamp(logEvent.Params, timeStamp, guid);
1112+
1113+
Assert.IsTrue(TestData.CompareObjects(expectedEvent, logEvent));
1114+
}
1115+
1116+
[Test]
1117+
public void TestConversionEventWithNumericValue1()
1118+
{
1119+
var guid = Guid.NewGuid();
1120+
var timeStamp = TestData.SecondsSince1970();
1121+
var payloadParams = new Dictionary<string, object>
1122+
{
1123+
{ "visitors", new object[]
1124+
{
1125+
new Dictionary<string, object>()
1126+
{
1127+
{ "snapshots", new object[]
1128+
{
1129+
new Dictionary<string, object>
1130+
{
1131+
{ "decisions", new object[]
1132+
{
1133+
new Dictionary<string, object>
1134+
{
1135+
{"campaign_id", "7719770039" },
1136+
{"experiment_id", "7716830082" },
1137+
{"variation_id", "7722370027" }
1138+
}
1139+
}
1140+
},
1141+
{ "events", new object[]
1142+
{
1143+
new Dictionary<string, object>
1144+
{
1145+
{"entity_id", "7718020063" },
1146+
{"timestamp", timeStamp },
1147+
{"uuid", guid },
1148+
{"key", "purchase" },
1149+
{"revenue", 10 },
1150+
{"value", 1.0 },
1151+
{"tags",
1152+
new Dictionary<string, object>
1153+
{
1154+
{"revenue", 10 },
1155+
{"value", 1.0 }
1156+
}
1157+
}
1158+
}
1159+
}
1160+
}
1161+
}
1162+
}
1163+
},
1164+
{ "attributes", new object[]
1165+
{
1166+
new Dictionary<string, object>
1167+
{
1168+
{"entity_id", ControlAttributes.BOT_FILTERING_ATTRIBUTE},
1169+
{"key", ControlAttributes.BOT_FILTERING_ATTRIBUTE},
1170+
{"type", "custom" },
1171+
{"value", true }
1172+
}
1173+
}
1174+
},
1175+
{ "visitor_id", TestUserId }
1176+
}
1177+
}
1178+
},
1179+
{"project_id", "7720880029" },
1180+
{"account_id", "1592310167" },
1181+
{"client_name", "csharp-sdk" },
1182+
{"client_version", Optimizely.SDK_VERSION },
1183+
{"revision", "15" },
1184+
{"anonymize_ip", false}
1185+
};
1186+
1187+
var expectedEvent = new LogEvent(
1188+
"https://logx.optimizely.com/v1/events",
1189+
payloadParams,
1190+
"POST",
1191+
new Dictionary<string, string>
1192+
{
1193+
{ "Content-Type", "application/json"}
1194+
});
1195+
1196+
var experimentToVariationMap = new Dictionary<string, Variation>
1197+
{
1198+
{"7716830082", new Variation{Id="7722370027", Key="control"} }
1199+
};
1200+
1201+
var logEvent = EventBuilder.CreateConversionEvent(Config, "purchase", experimentToVariationMap, TestUserId, null,
1202+
new EventTags
1203+
{
1204+
{"revenue", 10 },
1205+
{"value", 1.0 }
1206+
});
1207+
1208+
TestData.ChangeGUIDAndTimeStamp(logEvent.Params, timeStamp, guid);
1209+
1210+
Assert.IsTrue(TestData.CompareObjects(expectedEvent, logEvent));
1211+
}
1212+
[Test]
1213+
public void TestConversionEventWithRevenueValue1()
1214+
{
1215+
var guid = Guid.NewGuid();
1216+
var timeStamp = TestData.SecondsSince1970();
1217+
var payloadParams = new Dictionary<string, object>
1218+
{
1219+
{ "visitors", new object[]
1220+
{
1221+
new Dictionary<string, object>()
1222+
{
1223+
{ "snapshots", new object[]
1224+
{
1225+
new Dictionary<string, object>
1226+
{
1227+
{ "decisions", new object[]
1228+
{
1229+
new Dictionary<string, object>
1230+
{
1231+
{"campaign_id", "7719770039" },
1232+
{"experiment_id", "7716830082" },
1233+
{"variation_id", "7722370027" }
1234+
}
1235+
}
1236+
},
1237+
{ "events", new object[]
1238+
{
1239+
new Dictionary<string, object>
1240+
{
1241+
{"entity_id", "7718020063" },
1242+
{"timestamp", timeStamp },
1243+
{"uuid", guid },
1244+
{"key", "purchase" },
1245+
{"revenue", 1 },
1246+
{"value", 10.0 },
1247+
{"tags",
1248+
new Dictionary<string, object>
1249+
{
1250+
{"revenue", 1 },
1251+
{"value", 10.0 }
1252+
}
1253+
}
1254+
}
1255+
}
1256+
}
1257+
}
1258+
}
1259+
},
1260+
{ "attributes", new object[]
1261+
{
1262+
new Dictionary<string, object>
1263+
{
1264+
{"entity_id", ControlAttributes.BOT_FILTERING_ATTRIBUTE},
1265+
{"key", ControlAttributes.BOT_FILTERING_ATTRIBUTE},
1266+
{"type", "custom" },
1267+
{"value", true }
1268+
}
1269+
}
1270+
},
1271+
{ "visitor_id", TestUserId }
1272+
}
1273+
}
1274+
},
1275+
{"project_id", "7720880029" },
1276+
{"account_id", "1592310167" },
1277+
{"client_name", "csharp-sdk" },
1278+
{"client_version", Optimizely.SDK_VERSION },
1279+
{"revision", "15" },
1280+
{"anonymize_ip", false}
1281+
};
1282+
1283+
var expectedEvent = new LogEvent(
1284+
"https://logx.optimizely.com/v1/events",
1285+
payloadParams,
1286+
"POST",
1287+
new Dictionary<string, string>
1288+
{
1289+
{ "Content-Type", "application/json"}
1290+
});
1291+
1292+
var experimentToVariationMap = new Dictionary<string, Variation>
1293+
{
1294+
{"7716830082", new Variation{Id="7722370027", Key="control"} }
1295+
};
1296+
1297+
var logEvent = EventBuilder.CreateConversionEvent(Config, "purchase", experimentToVariationMap, TestUserId, null,
1298+
new EventTags
1299+
{
1300+
{"revenue", 1 },
1301+
{"value", 10.0 }
1302+
});
1303+
1304+
TestData.ChangeGUIDAndTimeStamp(logEvent.Params, timeStamp, guid);
1305+
1306+
Assert.IsTrue(TestData.CompareObjects(expectedEvent, logEvent));
1307+
}
1308+
1309+
10191310
[Test]
10201311
public void TestCreateConversionEventWithBucketingIDAttribute()
10211312
{

OptimizelySDK.Tests/Properties/AssemblyInfo.cs

+3-3
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,6 @@
3131
//
3232
// You can specify all the values or you can default the Revision and Build Numbers
3333
// by using the '*' as shown below:
34-
[assembly: AssemblyVersion("2.2.1.0")]
35-
[assembly: AssemblyFileVersion("2.2.1.0")]
36-
[assembly: AssemblyInformationalVersion("2.2.1")] // Used by Nuget.
34+
[assembly: AssemblyVersion("2.2.2.0")]
35+
[assembly: AssemblyFileVersion("2.2.2.0")]
36+
[assembly: AssemblyInformationalVersion("2.2.2")] // Used by Nuget.

OptimizelySDK/Properties/AssemblyInfo.cs

+3-3
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,6 @@
3838
// You can specify all the values or you can default the Build and Revision Numbers
3939
// by using the '*' as shown below:
4040
// [assembly: AssemblyVersion("1.0.*")]
41-
[assembly: AssemblyVersion("2.2.1.0")]
42-
[assembly: AssemblyFileVersion("2.2.1.0")]
43-
[assembly: AssemblyInformationalVersion("2.1.0")] // Used by Nuget.
41+
[assembly: AssemblyVersion("2.2.2.0")]
42+
[assembly: AssemblyFileVersion("2.2.2.0")]
43+
[assembly: AssemblyInformationalVersion("2.2.0")] // Used by Nuget.

OptimizelySDK/Utils/EventTagUtils.cs

+4-4
Original file line numberDiff line numberDiff line change
@@ -92,10 +92,10 @@ public static object GetNumericValue(Dictionary<string, object> eventTags, ILogg
9292
{
9393
logMessage = "Provided numeric value is boolean which is an invalid format.";
9494
logLevel = LogLevel.ERROR;
95-
}
96-
else if (!(eventTags[VALUE_EVENT_METRIC_NAME] is int) && !(eventTags[VALUE_EVENT_METRIC_NAME] is string) && !(eventTags[VALUE_EVENT_METRIC_NAME] is float)
97-
&& !(eventTags[VALUE_EVENT_METRIC_NAME] is decimal) && !(eventTags[VALUE_EVENT_METRIC_NAME] is double) && !(eventTags[VALUE_EVENT_METRIC_NAME] is float))
98-
{
95+
} else if (!(eventTags[VALUE_EVENT_METRIC_NAME] is int) && !(eventTags[VALUE_EVENT_METRIC_NAME] is string) && !(eventTags[VALUE_EVENT_METRIC_NAME] is float)
96+
&& !(eventTags[VALUE_EVENT_METRIC_NAME] is decimal) && !(eventTags[VALUE_EVENT_METRIC_NAME] is double) && !(eventTags[VALUE_EVENT_METRIC_NAME] is long)
97+
&& !(eventTags[VALUE_EVENT_METRIC_NAME] is short) && !(eventTags[VALUE_EVENT_METRIC_NAME] is uint))
98+
{
9999
logMessage = "Numeric metric value is not in integer, float, or string form.";
100100
logLevel = LogLevel.ERROR;
101101
}

0 commit comments

Comments
 (0)