@srcpush/react-native-code-push 1.0.3-develop.2 → 1.0.3-develop.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (65) hide show
  1. package/package.json +1 -1
  2. package/windows/CodePush/CodePush.def +0 -3
  3. package/windows/CodePush/CodePush.vcxproj +0 -198
  4. package/windows/CodePush/CodePush.vcxproj.filters +0 -91
  5. package/windows/CodePush/CodePushConfig.cpp +0 -104
  6. package/windows/CodePush/CodePushConfig.h +0 -66
  7. package/windows/CodePush/CodePushConfig.idl +0 -12
  8. package/windows/CodePush/CodePushDownloadHandler.cpp +0 -73
  9. package/windows/CodePush/CodePushDownloadHandler.h +0 -32
  10. package/windows/CodePush/CodePushNativeModule.cpp +0 -937
  11. package/windows/CodePush/CodePushNativeModule.h +0 -247
  12. package/windows/CodePush/CodePushPackage.cpp +0 -456
  13. package/windows/CodePush/CodePushPackage.h +0 -49
  14. package/windows/CodePush/CodePushTelemetryManager.cpp +0 -213
  15. package/windows/CodePush/CodePushTelemetryManager.h +0 -29
  16. package/windows/CodePush/CodePushUpdateUtils.cpp +0 -86
  17. package/windows/CodePush/CodePushUpdateUtils.h +0 -38
  18. package/windows/CodePush/CodePushUtils.cpp +0 -29
  19. package/windows/CodePush/CodePushUtils.h +0 -18
  20. package/windows/CodePush/FileUtils.cpp +0 -131
  21. package/windows/CodePush/FileUtils.h +0 -28
  22. package/windows/CodePush/PropertySheet.props +0 -16
  23. package/windows/CodePush/ReactPackageProvider.cpp +0 -15
  24. package/windows/CodePush/ReactPackageProvider.h +0 -22
  25. package/windows/CodePush/ReactPackageProvider.idl +0 -9
  26. package/windows/CodePush/miniz/LICENSE +0 -22
  27. package/windows/CodePush/miniz/miniz.c +0 -7657
  28. package/windows/CodePush/miniz/miniz.h +0 -1338
  29. package/windows/CodePush/miniz/readme.md +0 -37
  30. package/windows/CodePush/packages.config +0 -4
  31. package/windows/CodePush/pch.cpp +0 -1
  32. package/windows/CodePush/pch.h +0 -4
  33. package/windows-legacy/CodePush/CodePush.csproj +0 -128
  34. package/windows-legacy/CodePush/CodePushUtils.cs +0 -47
  35. package/windows-legacy/CodePush/FileUtils.cs +0 -40
  36. package/windows-legacy/CodePush/Properties/AssemblyInfo.cs +0 -29
  37. package/windows-legacy/CodePush/Properties/CodePush.rd.xml +0 -33
  38. package/windows-legacy/CodePush/UpdateManager.cs +0 -305
  39. package/windows-legacy/CodePush/UpdateUtils.cs +0 -46
  40. package/windows-legacy/CodePush.Net46/Adapters/Http/HttpProgress.cs +0 -28
  41. package/windows-legacy/CodePush.Net46/Adapters/Storage/ApplicationDataContainer.cs +0 -106
  42. package/windows-legacy/CodePush.Net46/CodePush.Net46.csproj +0 -103
  43. package/windows-legacy/CodePush.Net46/CodePushUtils.cs +0 -158
  44. package/windows-legacy/CodePush.Net46/FileUtils.cs +0 -55
  45. package/windows-legacy/CodePush.Net46/Properties/AssemblyInfo.cs +0 -36
  46. package/windows-legacy/CodePush.Net46/UpdateManager.cs +0 -330
  47. package/windows-legacy/CodePush.Net46/UpdateUtils.cs +0 -70
  48. package/windows-legacy/CodePush.Net46/packages.config +0 -5
  49. package/windows-legacy/CodePush.Net46.Test/ApplicationDataContainerTest.cs +0 -105
  50. package/windows-legacy/CodePush.Net46.Test/CodePush.Net46.Test.csproj +0 -137
  51. package/windows-legacy/CodePush.Net46.Test/Properties/AssemblyInfo.cs +0 -36
  52. package/windows-legacy/CodePush.Net46.Test/TelemetryManagerTest.cs +0 -117
  53. package/windows-legacy/CodePush.Net46.Test/app.config +0 -11
  54. package/windows-legacy/CodePush.Net46.Test/packages.config +0 -4
  55. package/windows-legacy/CodePush.Shared/CodePush.Shared.projitems +0 -22
  56. package/windows-legacy/CodePush.Shared/CodePush.Shared.shproj +0 -13
  57. package/windows-legacy/CodePush.Shared/CodePushConstants.cs +0 -35
  58. package/windows-legacy/CodePush.Shared/CodePushNativeModule.cs +0 -329
  59. package/windows-legacy/CodePush.Shared/CodePushReactPackage.cs +0 -235
  60. package/windows-legacy/CodePush.Shared/CodePushUtils.cs +0 -70
  61. package/windows-legacy/CodePush.Shared/InstallMode.cs +0 -9
  62. package/windows-legacy/CodePush.Shared/MinimumBackgroundListener.cs +0 -44
  63. package/windows-legacy/CodePush.Shared/SettingsManager.cs +0 -148
  64. package/windows-legacy/CodePush.Shared/TelemetryManager.cs +0 -250
  65. package/windows-legacy/CodePush.Shared/UpdateState.cs +0 -9
@@ -1,330 +0,0 @@
1
- using CodePush.Net46.Adapters.Http;
2
- using Newtonsoft.Json;
3
- using Newtonsoft.Json.Linq;
4
- using PCLStorage;
5
- using System;
6
- using System.IO;
7
- using System.IO.Compression;
8
- using System.Runtime.CompilerServices;
9
- using System.Threading.Tasks;
10
-
11
- namespace CodePush.ReactNative
12
- {
13
- internal class UpdateManager
14
- {
15
- #region Internal methods
16
-
17
- internal async Task ClearUpdatesAsync()
18
- {
19
- await (await UpdateUtils.GetCodePushFolderAsync().ConfigureAwait(false)).DeleteAsync().ConfigureAwait(false);
20
- }
21
-
22
- internal async Task DownloadPackageAsync(JObject updatePackage, string expectedBundleFileName, Progress<HttpProgress> downloadProgress)
23
- {
24
- // Using its hash, get the folder where the new update will be saved
25
- var codePushFolder = await UpdateUtils.GetCodePushFolderAsync().ConfigureAwait(false);
26
- var newUpdateHash = (string)updatePackage[CodePushConstants.PackageHashKey];
27
- var newUpdateFolder = await GetPackageFolderAsync(newUpdateHash, false).ConfigureAwait(false);
28
- if (newUpdateFolder != null)
29
- {
30
- // This removes any stale data in newUpdateFolder that could have been left
31
- // uncleared due to a crash or error during the download or install process.
32
- await newUpdateFolder.DeleteAsync().ConfigureAwait(false);
33
- }
34
-
35
- newUpdateFolder = await GetPackageFolderAsync(newUpdateHash, true).ConfigureAwait(false);
36
- var newUpdateMetadataFile = await newUpdateFolder.CreateFileAsync(CodePushConstants.PackageFileName, CreationCollisionOption.ReplaceExisting).ConfigureAwait(false);
37
- var downloadUrlString = (string)updatePackage[CodePushConstants.DownloadUrlKey];
38
- var downloadFile = await GetDownloadFileAsync().ConfigureAwait(false);
39
-
40
- await UpdateUtils.DownloadBundleAsync(downloadUrlString, downloadFile.Path, downloadProgress);
41
-
42
- try
43
- {
44
- // Unzip the downloaded file and then delete the zip
45
- var unzippedFolder = await CreateUnzippedFolderAsync().ConfigureAwait(false);
46
- /**
47
- * TODO:
48
- * 1) ZipFile.ExtractToDirectory is not reliable and throws exception if:
49
- * - path is too long (> 250 chars)
50
- *
51
- * 2) Un-zipping is quite long operation. Does it make sense for async?
52
- * await UpdateUtils.UnzipBundleAsync(downloadFile.Path, unzippedFolder.Path);
53
- *
54
- * Possible implementation
55
- *
56
- * internal async static Task UnzipBundleAsync(string zipFileName, string targetDir)
57
- * {
58
- * await Task.Run(() =>
59
- * {
60
- * ZipFile.ExtractToDirectory(zipFileName, targetDir)
61
- * return Task.CompletedTask;
62
- * });
63
- * }
64
- */
65
- ZipFile.ExtractToDirectory(downloadFile.Path, unzippedFolder.Path);
66
- await downloadFile.DeleteAsync().ConfigureAwait(false);
67
-
68
- // Merge contents with current update based on the manifest
69
- IFile diffManifestFile = null;
70
- try
71
- {
72
- diffManifestFile = await unzippedFolder.GetFileAsync(CodePushConstants.DiffManifestFileName).ConfigureAwait(false);
73
- }
74
- catch (FileNotFoundException)
75
- {
76
- //file may not be present in folder just skip it
77
- }
78
- if (diffManifestFile != null)
79
- {
80
- var currentPackageFolder = await GetCurrentPackageFolderAsync().ConfigureAwait(false);
81
- if (currentPackageFolder == null)
82
- {
83
- throw new InvalidDataException("Received a diff update, but there is no current version to diff against.");
84
- }
85
-
86
- await UpdateUtils.CopyNecessaryFilesFromCurrentPackageAsync(diffManifestFile, currentPackageFolder, newUpdateFolder).ConfigureAwait(false);
87
- await diffManifestFile.DeleteAsync().ConfigureAwait(false);
88
- }
89
-
90
- await FileUtils.MergeFoldersAsync(unzippedFolder, newUpdateFolder).ConfigureAwait(false);
91
- await unzippedFolder.DeleteAsync().ConfigureAwait(false);
92
-
93
- // For zip updates, we need to find the relative path to the jsBundle and save it in the
94
- // metadata so that we can find and run it easily the next time.
95
- var relativeBundlePath = await UpdateUtils.FindJSBundleInUpdateContentsAsync(newUpdateFolder, expectedBundleFileName).ConfigureAwait(false);
96
- if (relativeBundlePath == null)
97
- {
98
- throw new InvalidDataException("Update is invalid - A JS bundle file named \"" + expectedBundleFileName + "\" could not be found within the downloaded contents. Please check that you are releasing your CodePush updates using the exact same JS bundle file name that was shipped with your app's binary.");
99
- }
100
- else
101
- {
102
- if (diffManifestFile != null)
103
- {
104
- // TODO verify hash for diff update
105
- // CodePushUpdateUtils.verifyHashForDiffUpdate(newUpdateFolderPath, newUpdateHash);
106
- }
107
-
108
- updatePackage[CodePushConstants.RelativeBundlePathKey] = relativeBundlePath;
109
- }
110
- }
111
- catch (InvalidDataException)
112
- {
113
- // Downloaded file is not a zip, assume it is a jsbundle
114
- await downloadFile.RenameAsync(expectedBundleFileName).ConfigureAwait(false);
115
- await downloadFile.MoveAsync(newUpdateFolder.Path, NameCollisionOption.ReplaceExisting).ConfigureAwait(false);
116
- }
117
-
118
- // Save metadata to the folder
119
- await newUpdateMetadataFile.WriteAllTextAsync(JsonConvert.SerializeObject(updatePackage)).ConfigureAwait(false);
120
- }
121
-
122
- internal async Task<JObject> GetCurrentPackageAsync()
123
- {
124
- var packageHash = await GetCurrentPackageHashAsync().ConfigureAwait(false);
125
- return packageHash == null ? null : await GetPackageAsync(packageHash).ConfigureAwait(false);
126
- }
127
-
128
- internal async Task<IFile> GetCurrentPackageBundleAsync(string bundleFileName)
129
- {
130
- var packageFolder = await GetCurrentPackageFolderAsync().ConfigureAwait(false);
131
- if (packageFolder == null)
132
- {
133
- return null;
134
- }
135
-
136
- var currentPackage = await GetCurrentPackageAsync().ConfigureAwait(false);
137
- var relativeBundlePath = (string)currentPackage[CodePushConstants.RelativeBundlePathKey];
138
-
139
- return relativeBundlePath == null
140
- ? await packageFolder.GetFileAsync(bundleFileName).ConfigureAwait(false)
141
- : await packageFolder.GetFileAsync(relativeBundlePath).ConfigureAwait(false);
142
- }
143
-
144
- internal async Task<string> GetCurrentPackageHashAsync()
145
- {
146
- var info = await GetCurrentPackageInfoAsync().ConfigureAwait(false);
147
- var currentPackageShortHash = (string)info[CodePushConstants.CurrentPackageKey];
148
- if (currentPackageShortHash == null)
149
- {
150
- return null;
151
- }
152
-
153
- var currentPackageMetadata = await GetPackageAsync(currentPackageShortHash).ConfigureAwait(false);
154
- return currentPackageMetadata == null ? null : (string)currentPackageMetadata[CodePushConstants.PackageHashKey];
155
- }
156
-
157
- internal async Task<JObject> GetPackageAsync(string packageHash)
158
- {
159
- var packageFolder = await GetPackageFolderAsync(packageHash, false).ConfigureAwait(false);
160
- if (packageFolder == null)
161
- {
162
- return null;
163
- }
164
-
165
- try
166
- {
167
- var packageFile = await packageFolder.GetFileAsync(CodePushConstants.PackageFileName).ConfigureAwait(false);
168
- return await CodePushUtils.GetJObjectFromFileAsync(packageFile).ConfigureAwait(false);
169
- }
170
- catch (IOException)
171
- {
172
- return null;
173
- }
174
- }
175
-
176
- internal async Task<IFolder> GetPackageFolderAsync(string packageHash, bool createIfNotExists)
177
- {
178
- var codePushFolder = await UpdateUtils.GetCodePushFolderAsync().ConfigureAwait(false);
179
- try
180
- {
181
- packageHash = ShortenPackageHash(packageHash);
182
- return createIfNotExists
183
- ? await codePushFolder.CreateFolderAsync(packageHash, CreationCollisionOption.OpenIfExists).ConfigureAwait(false)
184
- : await codePushFolder.GetFolderAsync(packageHash).ConfigureAwait(false);
185
- }
186
- catch (FileNotFoundException)
187
- {
188
- return null;
189
- }
190
- catch (DirectoryNotFoundException)
191
- {
192
- return null;
193
- }
194
- }
195
-
196
- internal async Task<JObject> GetPreviousPackageAsync()
197
- {
198
- var packageHash = await GetPreviousPackageHashAsync().ConfigureAwait(false);
199
- return packageHash == null ? null : await GetPackageAsync(packageHash).ConfigureAwait(false);
200
- }
201
-
202
- internal async Task<string> GetPreviousPackageHashAsync()
203
- {
204
- var info = await GetCurrentPackageInfoAsync().ConfigureAwait(false);
205
- var previousPackageShortHash = (string)info[CodePushConstants.PreviousPackageKey];
206
- if (previousPackageShortHash == null)
207
- {
208
- return null;
209
- }
210
-
211
- var previousPackageMetadata = await GetPackageAsync(previousPackageShortHash).ConfigureAwait(false);
212
- return previousPackageMetadata == null ? null : (string)previousPackageMetadata[CodePushConstants.PackageHashKey];
213
- }
214
-
215
- internal async Task InstallPackageAsync(JObject updatePackage, bool currentUpdateIsPending)
216
- {
217
- var packageHash = (string)updatePackage[CodePushConstants.PackageHashKey];
218
- var info = await GetCurrentPackageInfoAsync().ConfigureAwait(false);
219
- if (currentUpdateIsPending)
220
- {
221
- // Don't back up current update to the "previous" position because
222
- // it is an unverified update which should not be rolled back to.
223
- var currentPackageFolder = await GetCurrentPackageFolderAsync().ConfigureAwait(false);
224
- if (currentPackageFolder != null)
225
- {
226
- await currentPackageFolder.DeleteAsync().ConfigureAwait(false);
227
- }
228
- }
229
- else
230
- {
231
- var previousPackageHash = await GetPreviousPackageHashAsync().ConfigureAwait(false);
232
- if (previousPackageHash != null && !previousPackageHash.Equals(packageHash))
233
- {
234
- var previousPackageFolder = await GetPackageFolderAsync(previousPackageHash, false).ConfigureAwait(false);
235
- if (previousPackageFolder != null)
236
- {
237
- await previousPackageFolder.DeleteAsync().ConfigureAwait(false);
238
- }
239
- }
240
-
241
- info[CodePushConstants.PreviousPackageKey] = info[CodePushConstants.CurrentPackageKey];
242
- }
243
-
244
- info[CodePushConstants.CurrentPackageKey] = packageHash;
245
- await UpdateCurrentPackageInfoAsync(info).ConfigureAwait(false);
246
- }
247
-
248
- internal async Task RollbackPackageAsync()
249
- {
250
- var info = await GetCurrentPackageInfoAsync().ConfigureAwait(false);
251
- var currentPackageFolder = await GetCurrentPackageFolderAsync().ConfigureAwait(false);
252
- if (currentPackageFolder != null)
253
- {
254
- await currentPackageFolder.DeleteAsync().ConfigureAwait(false);
255
- }
256
-
257
- info[CodePushConstants.CurrentPackageKey] = info[CodePushConstants.PreviousPackageKey];
258
- info[CodePushConstants.PreviousPackageKey] = null;
259
- await UpdateCurrentPackageInfoAsync(info).ConfigureAwait(false);
260
- }
261
-
262
- #endregion
263
-
264
- #region Private methods
265
-
266
- private async Task<IFolder> GetCurrentPackageFolderAsync()
267
- {
268
- var info = await GetCurrentPackageInfoAsync().ConfigureAwait(false);
269
- if (info == null)
270
- {
271
- return null;
272
- }
273
- var packageHash = (string)info[CodePushConstants.CurrentPackageKey];
274
- return packageHash == null ? null : await GetPackageFolderAsync(packageHash, false).ConfigureAwait(false);
275
- }
276
-
277
- private async Task<JObject> GetCurrentPackageInfoAsync()
278
- {
279
- var statusFile = await GetStatusFileAsync().ConfigureAwait(false);
280
- var info = await CodePushUtils.GetJObjectFromFileAsync(statusFile).ConfigureAwait(false);
281
-
282
- if (info != null)
283
- {
284
- return info;
285
- }
286
-
287
- // info file has been corrupted - re-create it
288
- await statusFile.DeleteAsync().ConfigureAwait(false);
289
- statusFile = await GetStatusFileAsync().ConfigureAwait(false);
290
- return await CodePushUtils.GetJObjectFromFileAsync(statusFile).ConfigureAwait(false);
291
- }
292
-
293
- private async Task<IFile> GetDownloadFileAsync()
294
- {
295
- var codePushFolder = await UpdateUtils.GetCodePushFolderAsync().ConfigureAwait(false);
296
- return await codePushFolder.CreateFileAsync(CodePushConstants.DownloadFileName, CreationCollisionOption.OpenIfExists).ConfigureAwait(false);
297
- }
298
-
299
- private async Task<IFile> GetStatusFileAsync()
300
- {
301
- var codePushFolder = await UpdateUtils.GetCodePushFolderAsync().ConfigureAwait(false);
302
- return await codePushFolder.CreateFileAsync(CodePushConstants.StatusFileName, CreationCollisionOption.OpenIfExists).ConfigureAwait(false);
303
- }
304
-
305
- private async Task<IFolder> CreateUnzippedFolderAsync()
306
- {
307
- var codePushFolder = await UpdateUtils.GetCodePushFolderAsync().ConfigureAwait(false);
308
- var isUnzippedFolderExists = await codePushFolder.CheckExistsAsync(CodePushConstants.UnzippedFolderName).ConfigureAwait(false);
309
-
310
- if (isUnzippedFolderExists != ExistenceCheckResult.NotFound)
311
- {
312
- await codePushFolder.GetFolderAsync(CodePushConstants.UnzippedFolderName).ContinueWith((existingFolder) => existingFolder.Result.DeleteAsync());
313
- }
314
-
315
- return await codePushFolder.CreateFolderAsync(CodePushConstants.UnzippedFolderName, CreationCollisionOption.OpenIfExists).ConfigureAwait(false);
316
- }
317
-
318
- private string ShortenPackageHash(string longPackageHash)
319
- {
320
- return longPackageHash.Substring(0, 8);
321
- }
322
-
323
- private async Task UpdateCurrentPackageInfoAsync(JObject packageInfo)
324
- {
325
- var file = await GetStatusFileAsync().ConfigureAwait(false);
326
- await file.WriteAllTextAsync(JsonConvert.SerializeObject(packageInfo)).ConfigureAwait(false);
327
- }
328
- #endregion
329
- }
330
- }
@@ -1,70 +0,0 @@
1
- using CodePush.Net46.Adapters.Http;
2
- using Newtonsoft.Json.Linq;
3
- using PCLStorage;
4
- using System;
5
- using System.IO;
6
- using System.Net;
7
- using System.Threading.Tasks;
8
-
9
- namespace CodePush.ReactNative
10
- {
11
- internal class UpdateUtils
12
- {
13
- internal async static Task CopyNecessaryFilesFromCurrentPackageAsync(IFile diffManifestFile, IFolder currentPackageFolder, IFolder newPackageFolder)
14
- {
15
- await FileUtils.MergeFoldersAsync(currentPackageFolder, newPackageFolder).ConfigureAwait(false);
16
- JObject diffManifest = await CodePushUtils.GetJObjectFromFileAsync(diffManifestFile).ConfigureAwait(false);
17
- var deletedFiles = (JArray)diffManifest["deletedFiles"];
18
- foreach (string fileNameToDelete in deletedFiles)
19
- {
20
- var fileToDelete = await newPackageFolder.GetFileAsync(fileNameToDelete).ConfigureAwait(false);
21
- await fileToDelete.DeleteAsync().ConfigureAwait(false);
22
- }
23
- }
24
-
25
- internal async static Task<string> FindJSBundleInUpdateContentsAsync(IFolder updateFolder, string expectedFileName)
26
- {
27
- foreach (IFile file in await updateFolder.GetFilesAsync().ConfigureAwait(false))
28
- {
29
- string fileName = file.Name;
30
- if (fileName.Equals(expectedFileName))
31
- {
32
- return fileName;
33
- }
34
- }
35
-
36
- foreach (IFolder folder in await updateFolder.GetFoldersAsync().ConfigureAwait(false))
37
- {
38
- string mainBundlePathInSubFolder = await FindJSBundleInUpdateContentsAsync(folder, expectedFileName).ConfigureAwait(false);
39
- if (mainBundlePathInSubFolder != null)
40
- {
41
- return Path.Combine(folder.Name, mainBundlePathInSubFolder);
42
- }
43
- }
44
-
45
- return null;
46
- }
47
-
48
- internal async static Task DownloadBundleAsync(string url, string fileName, IProgress<HttpProgress> downloadProgress)
49
- {
50
- var uri = new Uri(url);
51
- var client = new WebClient();
52
- client.DownloadProgressChanged += (s, e) =>
53
- {
54
- downloadProgress.Report(new HttpProgress
55
- {
56
- BytesReceived = (ulong)e.BytesReceived, //conversion long to ulong is safe
57
- TotalBytesToReceive = (ulong)e.TotalBytesToReceive //because size can't be negative
58
- });
59
- };
60
-
61
- await client.DownloadFileTaskAsync(uri, fileName);
62
- }
63
-
64
- internal static async Task<IFolder> GetCodePushFolderAsync()
65
- {
66
- var pathToCodePush = Path.Combine(CodePushUtils.GetFileBundlePrefix(), CodePushConstants.CodePushFolderPrefix);
67
- return await FileSystem.Current.LocalStorage.CreateFolderAsync(pathToCodePush, CreationCollisionOption.OpenIfExists).ConfigureAwait(false);
68
- }
69
- }
70
- }
@@ -1,5 +0,0 @@
1
- <?xml version="1.0" encoding="utf-8"?>
2
- <packages>
3
- <package id="Newtonsoft.Json" version="13.0.1" targetFramework="net452" />
4
- <package id="PCLStorage" version="1.0.2" targetFramework="net46" />
5
- </packages>
@@ -1,105 +0,0 @@
1
- using System;
2
- using Microsoft.VisualStudio.TestTools.UnitTesting;
3
- using CodePush.Net46.Adapters.Storage;
4
- using System.Threading.Tasks;
5
-
6
- namespace CodePush.Net46.Test
7
- {
8
- [TestClass]
9
- public class ApplicationDataContainerTest
10
- {
11
- readonly static string key1 = "key1";
12
- readonly static string key2 = "key2";
13
- readonly static string key3 = "key3";
14
-
15
- readonly static string val1 = "string data1";
16
- readonly static string val2 = "string data2";
17
- readonly static string val3 = "string data1";
18
-
19
- [TestMethod]
20
- public void TestInMemmorySet()
21
- {
22
- var settings = new ApplicationDataContainer();
23
-
24
- settings.Values[key1] = val1;
25
- settings.Values[key2] = val2;
26
- settings.Values[key3] = val3;
27
-
28
- Assert.AreEqual(settings.Values[key1], val1);
29
- Assert.AreEqual(settings.Values[key2], val2);
30
- Assert.AreEqual(settings.Values[key3], val3);
31
-
32
- settings.DeleteAsync().Wait();
33
- }
34
-
35
- [TestMethod]
36
- public void TestInMemmoryReset()
37
- {
38
- var settings = new ApplicationDataContainer();
39
-
40
- settings.Values[key1] = val1;
41
- settings.Values[key1] = val2;
42
- settings.Values[key1] = val3;
43
-
44
- Assert.AreEqual(settings.Values[key1], val3);
45
-
46
- settings.DeleteAsync().Wait();
47
- }
48
-
49
- [TestMethod]
50
- public void TestInMemmoryRemove()
51
- {
52
- var settings = new ApplicationDataContainer();
53
-
54
- settings.Values[key1] = val1;
55
- settings.Values[key2] = val2;
56
- settings.Values[key3] = val3;
57
-
58
- settings.Values.Remove(key2);
59
-
60
- Assert.AreEqual(settings.Values[key1], val1);
61
- Assert.IsNull(settings.Values[key2]);
62
- Assert.AreEqual(settings.Values[key3], val3);
63
-
64
- settings.DeleteAsync().Wait();
65
- }
66
-
67
- [TestMethod]
68
- public void TestPersistentSet()
69
- {
70
- var settings = new ApplicationDataContainer();
71
-
72
- settings.Values[key1] = val1;
73
- settings.Values[key2] = val2;
74
- settings.Values[key3] = val3;
75
-
76
- settings = new ApplicationDataContainer();
77
-
78
- Assert.AreEqual(settings.Values[key1], val1);
79
- Assert.AreEqual(settings.Values[key2], val2);
80
- Assert.AreEqual(settings.Values[key3], val3);
81
-
82
- settings.DeleteAsync().Wait();
83
- }
84
-
85
- [TestMethod]
86
- public void TestPersistentRemove()
87
- {
88
- var settings = new ApplicationDataContainer();
89
-
90
- settings.Values[key1] = val1;
91
- settings.Values[key2] = val2;
92
- settings.Values[key3] = val3;
93
-
94
- settings.Values.Remove(key2);
95
-
96
- settings = new ApplicationDataContainer();
97
-
98
- Assert.AreEqual(settings.Values[key1], val1);
99
- Assert.IsNull(settings.Values[key2]);
100
- Assert.AreEqual(settings.Values[key3], val3);
101
-
102
- settings.DeleteAsync().Wait();
103
- }
104
- }
105
- }
@@ -1,137 +0,0 @@
1
- <?xml version="1.0" encoding="utf-8"?>
2
- <Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3
- <PropertyGroup>
4
- <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
5
- <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
6
- <ProjectGuid>{BBB48F0B-AF6F-4A14-AFA4-306D3FB0B7CF}</ProjectGuid>
7
- <OutputType>Library</OutputType>
8
- <AppDesignerFolder>Properties</AppDesignerFolder>
9
- <RootNamespace>CodePush.Net46.Test</RootNamespace>
10
- <AssemblyName>CodePush.Net46.Test</AssemblyName>
11
- <TargetFrameworkVersion>v4.6</TargetFrameworkVersion>
12
- <FileAlignment>512</FileAlignment>
13
- <ProjectTypeGuids>{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
14
- <VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion>
15
- <VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
16
- <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\$(VisualStudioVersion)\UITestExtensionPackages</ReferencePath>
17
- <IsCodedUITest>False</IsCodedUITest>
18
- <TestProjectType>UnitTest</TestProjectType>
19
- </PropertyGroup>
20
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
21
- <DebugSymbols>true</DebugSymbols>
22
- <DebugType>full</DebugType>
23
- <Optimize>false</Optimize>
24
- <OutputPath>bin\Debug\</OutputPath>
25
- <DefineConstants>DEBUG;TRACE</DefineConstants>
26
- <ErrorReport>prompt</ErrorReport>
27
- <WarningLevel>4</WarningLevel>
28
- </PropertyGroup>
29
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
30
- <DebugType>pdbonly</DebugType>
31
- <Optimize>true</Optimize>
32
- <OutputPath>bin\Release\</OutputPath>
33
- <DefineConstants>TRACE</DefineConstants>
34
- <ErrorReport>prompt</ErrorReport>
35
- <WarningLevel>4</WarningLevel>
36
- </PropertyGroup>
37
- <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
38
- <DebugSymbols>true</DebugSymbols>
39
- <OutputPath>bin\x64\Debug\</OutputPath>
40
- <DefineConstants>DEBUG;TRACE</DefineConstants>
41
- <DebugType>full</DebugType>
42
- <PlatformTarget>x64</PlatformTarget>
43
- <ErrorReport>prompt</ErrorReport>
44
- <CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
45
- </PropertyGroup>
46
- <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
47
- <OutputPath>bin\x64\Release\</OutputPath>
48
- <DefineConstants>TRACE</DefineConstants>
49
- <Optimize>true</Optimize>
50
- <DebugType>pdbonly</DebugType>
51
- <PlatformTarget>x64</PlatformTarget>
52
- <ErrorReport>prompt</ErrorReport>
53
- <CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
54
- </PropertyGroup>
55
- <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
56
- <DebugSymbols>true</DebugSymbols>
57
- <OutputPath>bin\x86\Debug\</OutputPath>
58
- <DefineConstants>DEBUG;TRACE</DefineConstants>
59
- <DebugType>full</DebugType>
60
- <PlatformTarget>x86</PlatformTarget>
61
- <ErrorReport>prompt</ErrorReport>
62
- <CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
63
- </PropertyGroup>
64
- <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
65
- <OutputPath>bin\x86\Release\</OutputPath>
66
- <DefineConstants>TRACE</DefineConstants>
67
- <Optimize>true</Optimize>
68
- <DebugType>pdbonly</DebugType>
69
- <PlatformTarget>x86</PlatformTarget>
70
- <ErrorReport>prompt</ErrorReport>
71
- <CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
72
- </PropertyGroup>
73
- <ItemGroup>
74
- <Reference Include="Newtonsoft.Json, Version=13.0.1.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
75
- <SpecificVersion>False</SpecificVersion>
76
- <HintPath>..\..\Examples\CodePushDemoApp\windows\packages\Newtonsoft.Json.13.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
77
- <Private>True</Private>
78
- </Reference>
79
- <Reference Include="System" />
80
- </ItemGroup>
81
- <Choose>
82
- <When Condition="('$(VisualStudioVersion)' == '10.0' or '$(VisualStudioVersion)' == '') and '$(TargetFrameworkVersion)' == 'v3.5'">
83
- <ItemGroup>
84
- <Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework, Version=10.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" />
85
- </ItemGroup>
86
- </When>
87
- <Otherwise>
88
- <ItemGroup>
89
- <Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework">
90
- <Private>False</Private>
91
- </Reference>
92
- </ItemGroup>
93
- </Otherwise>
94
- </Choose>
95
- <ItemGroup>
96
- <Compile Include="ApplicationDataContainerTest.cs" />
97
- <Compile Include="Properties\AssemblyInfo.cs" />
98
- <Compile Include="TelemetryManagerTest.cs" />
99
- </ItemGroup>
100
- <ItemGroup>
101
- <ProjectReference Include="..\CodePush.Net46\CodePush.Net46.csproj">
102
- <Project>{4dfe3f9f-5e15-4f17-8fd4-33ff0519348e}</Project>
103
- <Name>CodePush.Net46</Name>
104
- </ProjectReference>
105
- </ItemGroup>
106
- <ItemGroup>
107
- <None Include="app.config" />
108
- <None Include="packages.config" />
109
- </ItemGroup>
110
- <Choose>
111
- <When Condition="'$(VisualStudioVersion)' == '10.0' And '$(IsCodedUITest)' == 'True'">
112
- <ItemGroup>
113
- <Reference Include="Microsoft.VisualStudio.QualityTools.CodedUITestFramework, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
114
- <Private>False</Private>
115
- </Reference>
116
- <Reference Include="Microsoft.VisualStudio.TestTools.UITest.Common, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
117
- <Private>False</Private>
118
- </Reference>
119
- <Reference Include="Microsoft.VisualStudio.TestTools.UITest.Extension, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
120
- <Private>False</Private>
121
- </Reference>
122
- <Reference Include="Microsoft.VisualStudio.TestTools.UITesting, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
123
- <Private>False</Private>
124
- </Reference>
125
- </ItemGroup>
126
- </When>
127
- </Choose>
128
- <Import Project="$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets" Condition="Exists('$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets')" />
129
- <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
130
- <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
131
- Other similar extension points exist, see Microsoft.Common.targets.
132
- <Target Name="BeforeBuild">
133
- </Target>
134
- <Target Name="AfterBuild">
135
- </Target>
136
- -->
137
- </Project>