public void TestSuccessEndPointAdded() {
            var pushEvents = new PushEventsController();

            pushEvents.Execute();

            pushEvents.Tunnel(CommandBuilder.EventsEstablishJsonStream("id", "http://localhost/", "key", 10, new List<String>() {
                "EventName"
            }).SetOrigin(CommandOrigin.Local));

            Assert.AreEqual("id", pushEvents.EndPoints.First().Value.Id);
            Assert.AreEqual(new Uri("http://localhost/"), pushEvents.EndPoints.First().Value.Uri);
            Assert.AreEqual("key", pushEvents.EndPoints.First().Value.StreamKey);
            Assert.AreEqual(10, pushEvents.EndPoints.First().Value.Interval);
            Assert.AreEqual(new List<String>() {
                "EventName"
            }, pushEvents.EndPoints.First().Value.InclusiveNames);
        }
        public void TestSuccessTwoEndPointsSaved() {
            var pushEvents = new PushEventsController();

            pushEvents.Execute();

            pushEvents.Tunnel(CommandBuilder.EventsEstablishJsonStream("id1", "http://localhost/", "key1", 10, new List<String>() {
                "EventName1"
            }).SetOrigin(CommandOrigin.Local));

            pushEvents.Tunnel(CommandBuilder.EventsEstablishJsonStream("id2", "http://lolcatshost/", "key2", 20, new List<String>() {
                "EventName2"
            }).SetOrigin(CommandOrigin.Local));

            Assert.AreEqual(2, pushEvents.Shared.Variables.FlashVariables.First(archive => archive.Key.ToLower() == CommonVariableNames.EventsPushConfigGroups.ToString().ToLower()).Value.ToList<String>().Count);
        }
        public void TestSuccessPreviouslySetupWillReflash() {
            var pushEvents = new PushEventsController();

            // Set an existing value for the EventsPushConfigGroups
            pushEvents.Shared.Variables.Tunnel(CommandBuilder.VariablesSet(CommonVariableNames.EventsPushConfigGroups, "id1").SetOrigin(CommandOrigin.Local));

            pushEvents.Execute();

            // Setup a end point to use previously set EventsPushConfigGroups id
            pushEvents.Tunnel(CommandBuilder.EventsEstablishJsonStream("id1", "http://localhost/", "key1", 10, new List<String>() {
                "EventName1"
            }).SetOrigin(CommandOrigin.Local));

            // This id should be set in the config.
            Assert.AreEqual(1, pushEvents.Shared.Variables.FlashVariables.First(archive => archive.Key.ToLower() == CommonVariableNames.EventsPushConfigGroups.ToString().ToLower()).Value.ToList<String>().Count);
        }
        public void TestSuccessTwoEndPointsEstablished() {
            var pushEvents = new PushEventsController();

            pushEvents.Execute();

            pushEvents.Tunnel(CommandBuilder.EventsEstablishJsonStream("id1", "http://localhost/", "key1", 10, new List<String>() {
                "EventName1"
            }).SetOrigin(CommandOrigin.Local));

            pushEvents.Tunnel(CommandBuilder.EventsEstablishJsonStream("id2", "http://lolcatshost/", "key2", 20, new List<String>() {
                "EventName2"
            }).SetOrigin(CommandOrigin.Local));

            Assert.AreEqual(2, pushEvents.EndPoints.Count);
        }