diff --git a/JdSoft.Apple.Apns.Notifications/NotificationService.cs b/JdSoft.Apple.Apns.Notifications/NotificationService.cs
index de0f921..3020dd6 100644
--- a/JdSoft.Apple.Apns.Notifications/NotificationService.cs
+++ b/JdSoft.Apple.Apns.Notifications/NotificationService.cs
@@ -197,6 +197,19 @@ public NotificationService( bool sandbox, byte[] p12FileBytes, string p12FilePas
{
}
+ ///
+ /// Constructor
+ ///
+ /// Push Notification Gateway Host
+ /// Push Notification Gateway Port
+ /// Stream to PKCS12 .p12 or .pfx file containing Public and Private Keys
+ /// Password protecting the p12File
+ /// Number of Apns Connections to start with
+ public NotificationService(bool sandbox, Stream p12FileStream, string p12FilePassword, int connections) :
+ this(sandbox ? hostSandbox : hostProduction, apnsPort, getAllBytesFromStream(p12FileStream), p12FilePassword, connections)
+ {
+ }
+
#endregion
#region Properties
@@ -473,6 +486,21 @@ private bool queueRandom(Notification notification)
return false;
}
+
+ private static byte[] getAllBytesFromStream(Stream s)
+ {
+ byte[] buffer = new byte[16 * 1024];
+
+ using (MemoryStream ms = new MemoryStream())
+ {
+ int read;
+
+ while ((read = s.Read(buffer, 0, buffer.Length)) > 0)
+ ms.Write(buffer, 0, read);
+
+ return ms.ToArray();
+ }
+ }
#endregion
}
}
diff --git a/JdSoft.Apple.Apns.vsmdi b/JdSoft.Apple.Apns.vsmdi
new file mode 100644
index 0000000..0ac1d89
--- /dev/null
+++ b/JdSoft.Apple.Apns.vsmdi
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Local.testsettings b/Local.testsettings
new file mode 100644
index 0000000..86185cd
--- /dev/null
+++ b/Local.testsettings
@@ -0,0 +1,10 @@
+
+
+ These are default test settings for a local test run.
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Tests.Notifications/Properties/AssemblyInfo.cs b/Tests.Notifications/Properties/AssemblyInfo.cs
new file mode 100644
index 0000000..6ae31f2
--- /dev/null
+++ b/Tests.Notifications/Properties/AssemblyInfo.cs
@@ -0,0 +1,35 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("Tests.Notifications")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("Tests.Notifications")]
+[assembly: AssemblyCopyright("Copyright © 2012")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM components. If you need to access a type in this assembly from
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("915e6cb7-569f-42a7-be6c-baa27bbd88e5")]
+
+// Version information for an assembly consists of the following four values:
+//
+// Major Version
+// Minor Version
+// Build Number
+// Revision
+//
+// You can specify all the values or you can default the Build and Revision Numbers
+// by using the '*' as shown below:
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/Tests.Notifications/Tests.Notifications.csproj b/Tests.Notifications/Tests.Notifications.csproj
new file mode 100644
index 0000000..bad9622
--- /dev/null
+++ b/Tests.Notifications/Tests.Notifications.csproj
@@ -0,0 +1,57 @@
+
+
+
+ Debug
+ AnyCPU
+
+
+ 2.0
+ 915e6cb7-569f-42a7-be6c-baa27bbd88e5
+ Library
+ Properties
+ Tests.Notifications
+ Tests.Notifications
+ v4.0
+ 512
+ {3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
+
+
+ true
+ full
+ false
+ bin\Debug\
+ DEBUG;TRACE
+ prompt
+ 4
+
+
+ pdbonly
+ true
+ bin\Release\
+ TRACE
+ prompt
+ 4
+
+
+
+
+ 3.5
+
+
+
+
+ False
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Tests.Notifications/UnitTest1.cs b/Tests.Notifications/UnitTest1.cs
new file mode 100644
index 0000000..b1a6680
--- /dev/null
+++ b/Tests.Notifications/UnitTest1.cs
@@ -0,0 +1,21 @@
+using System;
+using System.Text;
+using System.Collections.Generic;
+using System.Linq;
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+using JdSoft.Apple.Apns.Notifications;
+
+namespace Tests.Notifications
+{
+ [TestClass]
+ public class NotificationCreationTest
+ {
+ [TestMethod]
+ public void NewNotificationTest()
+ {
+ var n = new Notification("", new NotificationPayload("This is a test", 9, null));
+
+ Assert.IsNotNull(n);
+ }
+ }
+}
diff --git a/TraceAndTestImpact.testsettings b/TraceAndTestImpact.testsettings
new file mode 100644
index 0000000..3eb8f1b
--- /dev/null
+++ b/TraceAndTestImpact.testsettings
@@ -0,0 +1,9 @@
+
+
+ These are test settings for Trace and Test Impact.
+
+
+
+
+
+
\ No newline at end of file