Exemple #1
0
        static void Main(string[] args)
        {
            var nodeIndex = CommandLine.GetInt32("multinode.index");
            var assemblyFileName = CommandLine.GetProperty("multinode.test-assembly");
            var typeName = CommandLine.GetProperty("multinode.test-class");
            var testName = CommandLine.GetProperty("multinode.test-method");
            var displayName = testName;

            Thread.Sleep(TimeSpan.FromSeconds(10));

            using (var controller = new XunitFrontController(assemblyFileName))
            {
                /* need to pass in just the assembly name to Discovery, not the full path
                 * i.e. "Akka.Cluster.Tests.MultiNode.dll"
                 * not "bin/Release/Akka.Cluster.Tests.MultiNode.dll" - this will cause
                 * the Discovery class to actually not find any indivudal specs to run
                 */
                var assemblyName = Path.GetFileName(assemblyFileName);
                Console.WriteLine("Running specs for {0} [{1}]", assemblyName, assemblyFileName);
                using (var discovery = new Discovery(assemblyName, typeName))
                {
                    using (var sink = new Sink(nodeIndex))
                    {
                        Thread.Sleep(10000);
                        try
                        {
                            controller.Find(true, discovery, TestFrameworkOptions.ForDiscovery());
                            discovery.Finished.WaitOne();
                            controller.RunTests(discovery.TestCases, sink, TestFrameworkOptions.ForExecution());
                        }
                        catch (AggregateException ex)
                        {
                            var specFail = new SpecFail(nodeIndex, displayName);
                            specFail.FailureExceptionTypes.Add(ex.GetType().ToString());
                            specFail.FailureMessages.Add(ex.Message);
                            specFail.FailureStackTraces.Add(ex.StackTrace);
                            foreach (var innerEx in ex.Flatten().InnerExceptions)
                            {
                                specFail.FailureExceptionTypes.Add(innerEx.GetType().ToString());
                                specFail.FailureMessages.Add(innerEx.Message);
                                specFail.FailureStackTraces.Add(innerEx.StackTrace);
                            }
                            Console.WriteLine(specFail);
                            Environment.Exit(1); //signal failure
                        }
                        catch (Exception ex)
                        {
                            var specFail = new SpecFail(nodeIndex, displayName);
                            specFail.FailureExceptionTypes.Add(ex.GetType().ToString());
                            specFail.FailureMessages.Add(ex.Message);
                            specFail.FailureStackTraces.Add(ex.StackTrace);
                            Console.WriteLine(specFail);
                            Environment.Exit(1); //signal failure
                        }
                        sink.Finished.WaitOne();
                        Environment.Exit(sink.Passed ? 0 : 1);
                    }
                }
            }
        }
 public async void TestGetRecommendedChannels()
 {
     var serverConnectionMock = new Mock<IServerConnection>();
     serverConnectionMock.Setup(s => s.Get(It.IsAny<Uri>(), It.IsAny<Action<HttpWebRequest>>())).ReturnsAsync(Resource.ChannelListExample).Verifiable();
     var session = new Session(serverConnectionMock.Object);
     var discovery = new Discovery(session);
     var channelGroups = await discovery.GetRecommendedChannels();
     serverConnectionMock.Verify();
     Assert.IsNotNull(channelGroups);
     Assert.AreEqual(4, channelGroups.Length);
     for (int i = 0; i < channelGroups.Length; ++i)
     {
         var channelGroup = channelGroups[i];
         Assert.IsNotEmpty(channelGroup.GroupName);
         Assert.IsNotEmpty(channelGroup.Channels);
         if (i > 0)
         {
             Assert.Greater(channelGroups[i].GroupId, channelGroups[i - 1].GroupId);
         }
         foreach (var channel in channelGroup.Channels)
         {
             Validator.ValidateChannel(channel);
         }
     }
 }
        public async void TestSearchChannel()
        {
            var emptySearchChannelResult = JObject.Parse(Resource.SearchChannelResultExample).DeepClone();
            emptySearchChannelResult["channels"] = null;
            var serverConnectionMock = new Mock<IServerConnection>();
            serverConnectionMock.Setup(s => s.Get(It.Is<Uri>(u => u.AbsolutePath.EndsWith("search/channel") && int.Parse(u.GetQueries()["start"]) < 100), It.IsAny<Action<HttpWebRequest>>())).ReturnsAsync(Resource.SearchChannelResultExample).Verifiable();
            serverConnectionMock.Setup(s => s.Get(It.Is<Uri>(u => u.AbsolutePath.EndsWith("search/channel") && int.Parse(u.GetQueries()["start"]) >= 100), It.IsAny<Action<HttpWebRequest>>())).ReturnsAsync(emptySearchChannelResult.ToString()).Verifiable();

            var discovery = new Discovery(new Session(serverConnectionMock.Object));
            var start = 0;
            var limit = 20;
            while (true)
            {
                var channels = await discovery.SearchChannel("any text here", start, limit);
                Assert.IsNotNull(channels);
                Assert.Greater(channels.TotalCount, 0);
                if (start < 100) Assert.IsNotEmpty(channels.CurrentList);
                foreach (var channel in channels.CurrentList)
                {
                    Validator.ValidateChannel(channel);
                }
                if (channels.CurrentList.Count == 0) break;
                start += limit;
            }
            serverConnectionMock.Verify();
        }
 protected override EndpointAddress GetEndpoint(Discovery.Service service)
 {
     return new EndpointAddress(
         string.Format("net.pipe://localhost/Nvents.Services.Network/{0}/{1}/EventService",
         pipe,
         service.Guid));
 }
Exemple #5
0
        public void Save()
        {
            Discovery dis = new Discovery();
            dis.AddAssembly(Assembly.GetExecutingAssembly());
            Stream stream = dis.GetResource("SolutionTemplate.txt");

            using (StreamReader reader = new StreamReader(stream))
            {
                string solutionContents = reader.ReadToEnd();

                string solutionPath = Path.Combine(Folder, SolutionName + ".sln");
                string projectsSection = "";
                foreach (Project project in Projects)
                {
                    project.RelPath = Path.Combine(project.OutputFolder.Replace(Folder + Path.DirectorySeparatorChar, ""), project.Name + ".csproj");
                    projectsSection += string.Format("Project(\"{{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}}\") = \"{0}\", \"{1}\", \"{2}\"\r\n" +
                                                     "\tProjectSection(ProjectDependencies) = postProject\r\n" +
                                                     "\tEndProjectSection\r\n" +
                                                     "EndProject\r\n", project.Name, project.RelPath, "{" + project.Guid + "}");
                }

                solutionContents = solutionContents.Replace("#Projects#", projectsSection.TrimEnd('\r', '\n'));
                string configurationTemplate = "\t\t{0}.Debug.ActiveCfg = Debug|.NET\r\n" +
                                               "\t\t{0}.Debug.Build.0 = Debug|.NET\r\n" +
                                               "\t\t{0}.Release.ActiveCfg = Release|.NET\r\n" +
                                               "\t\t{0}.Release.Build.0 = Release|.NET\r\n";
                string configuration = "";
                foreach (Project project in Projects)
                {
                    configuration += string.Format(configurationTemplate, "{" + project.Guid + "}");
                }
                solutionContents = solutionContents.Replace("#Configuration#", "\r\n" + configuration + "\t");
                FileSystemUtil.WriteFile(solutionPath, solutionContents);
            }
        }
Exemple #6
0
        public void TheDefaultDiscoveryShouldDiscoverClassesWhoseNameEndsWithTests()
        {
            var defaultDiscovery = new Discovery();

            DiscoveredTestClasses(defaultDiscovery)
            .ShouldEqual(
                typeof(NameEndsWithTests));
        }
 private static void fetchdata(Discovery item)
 {
     getingTweetFromURL("https://twitter.com/search?f=broadcasts&vertical=default&q=" + item.SearchKeyword + "&src=tyah");
     getingTweetFromURL("https://twitter.com/search?f=news&vertical=default&q=" + item.SearchKeyword + "&src=tyah");
     getingTweetFromURL("https://twitter.com/search?f=videos&vertical=default&q=" + item.SearchKeyword + "&src=tyah");
     getingTweetFromURL("https://twitter.com/search?f=tweets&vertical=default&q=" + item.SearchKeyword + "&src=tyah");
     getingTweetFromURL("https://twitter.com/search?vertical=default&q=" + item.SearchKeyword + "&src=tyah");
 }
Exemple #8
0
 // Use this for initialization
 void Start()
 {
     discovery = Discovery.instance;
     slots     = GetComponentsInChildren <DiscoverySlot>();
     discovery.onDiscoveryChangeCallBack += SetUp;
     SetUp();
     firstTime = false;
 }
 protected override EndpointAddress GetEndpoint(Discovery.Service service)
 {
     return new EndpointAddress(
         string.Format("net.tcp://{0}:{1}/Nvents.Services.Network/{2}/EventService",
         service.IPAddress,
         service.Port,
         service.Guid));
 }
Exemple #10
0
 public void Stop()
 {
     if (cancellationTokenSource != null && !cancellationTokenSource.IsCancellationRequested)
     {
         cancellationTokenSource.Cancel();
     }
     onvifDiscovery = null;
 }
            public string ProbeDevice(IPAddress address, int attempts)
            {
                Discovery discovery = new Discovery(_address);

                discovery.Discovered        += discovery_Discovered;
                discovery.DiscoveryFinished += discovery_DiscoveryFinished;

                for (int i = 1; i <= attempts; i++)
                {
                    bool stop;
                    lock (this)
                    {
                        stop = _stop;
                    }

                    if (stop)
                    {
                        return(string.Empty);
                    }

                    NotifyProgress(string.Format("Sending Probe Request {0}", i));

                    discovery.Probe(true, address, null, null);

                    System.Diagnostics.Debug.WriteLine(string.Format("{0}  Probe {1}",
                                                                     DateTime.Now.ToString("HH:mm:ss ffffff"), i));

                    DateTime startTime = DateTime.Now;
                    int      handle    = WaitHandle.WaitAny(new WaitHandle[] { _discoveredEvent, _timeoutEvent, _stopEvent }, Discovery.WS_DISCOVER_TIMEOUT + 3000);
                    DateTime endTime   = DateTime.Now;
                    discovery.Close();

                    if (handle >= 0)
                    {
                        if (handle == 0)
                        {
                            System.Diagnostics.Debug.WriteLine(string.Format("{0} Discovered",
                                                                             DateTime.Now.ToString("HH:mm:ss ffffff")));
                            break;
                        }
                        else if (handle == 1)
                        {
                            System.Diagnostics.Debug.WriteLine(string.Format("{0} Timeout",
                                                                             DateTime.Now.ToString("HH:mm:ss ffffff")));
                            NotifyProgress("No response");
                        }
                        else if (handle == 2)
                        {
                            System.Diagnostics.Debug.WriteLine("Device finder - stop");
                            throw new StopEventException();
                        }
                    }

                    System.Diagnostics.Debug.WriteLine(string.Format("{0}  continue...", DateTime.Now.ToString("HH:mm:ss ffffff")));
                }

                return(_probeMessage);
            }
 public DiscoveryListViewItem(Discovery discovery)
 {
     Discovery = discovery;
     Text      = discovery.Bssid;
     SubItems.Add(discovery.Ssid);
     SubItems.Add(discovery.Rssi.ToString());
     SubItems.Add(discovery.DefaultCipherAlgorithm.ToString());
     SubItems.Add(discovery.DefaultAuthAlgorithm.ToString());
 }
Exemple #13
0
 private void btnFind_Click(object sender, EventArgs e)
 {
     if (Discovery.DiscoveryFinished)
     {
         Discovery.FindDevices();
         SetPanel(pnlStep1);
         btnFind.Text = "...";
     }
 }
Exemple #14
0
        static void Main(string[] args)
        {
            var worker = new Worker();

            foreach (var d in Discovery.GetDelegates <MethodGetterAttribute, Action <Worker> >())
            {
                d.Invoke(worker);
            }
        }
Exemple #15
0
        /// <summary>
        ///     Determines whether the specified crawl request is disallowed.
        /// </summary>
        /// <param name = "discovery">The discovery.</param>
        /// <param name = "arachnodeDAO">The arachnode DAO.</param>
        /// <returns>
        ///     <c>true</c> if the specified crawl request is disallowed; otherwise, <c>false</c>.
        /// </returns>
        public override bool IsDisallowed(Discovery <TArachnodeDAO> discovery, IArachnodeDAO arachnodeDAO)
        {
            //perform application specific logic here...
            //discovery.IsStorable = discovery.Uri.AbsoluteUri.ToLowerInvariant().Contains(".aspx");

            //this plugin could detemine whether a Discovery was Disallowed, but in this example, it doesn't make this determination.

            return(false);
        }
Exemple #16
0
 public Event(
     Discovery discovery,
     CellGroup group,
     long triggerDate,
     long eventTypeId) :
     base(discovery, group, triggerDate, eventTypeId)
 {
     _discovery = discovery;
 }
Exemple #17
0
        public async void TestSearchChannel(string query, int size)
        {
            var player      = Generator.Player;
            var discovery   = new Discovery(player.Session);
            var start       = 0;
            var allChannels = new List <Channel>();
            int?totalCount  = null;

            while (true)
            {
                var channels = await discovery.SearchChannel(query, start, size);

                Assert.IsNotNull(channels);
                Assert.IsNotNull(channels.CurrentList);
                Assert.IsNotNull(channels.TotalCount);
                Assert.Greater(channels.TotalCount.Value, 0);
                if (totalCount.HasValue)
                {
                    Assert.AreEqual(totalCount.Value, channels.TotalCount);
                }
                else
                {
                    totalCount = channels.TotalCount;
                }
                if (channels.CurrentList.Count == 0)
                {
                    break;
                }
                foreach (var channel in channels.CurrentList)
                {
                    Validator.ValidateChannel(channel);
                }
                allChannels.AddRange(channels.CurrentList);
                start += size;
            }
            Assert.IsNotEmpty(allChannels);
            // Bug #16: seems the server doesn't always return all the channels. Maybe the server has some filter logic.
            //Assert.AreEqual(totalCount.Value, allChannels.Count);
            //Assert.GreaterOrEqual(start, totalCount.Value);

            var random = new Random();

            for (var i = 0; i < 5; ++i)
            {
                var channel = allChannels[random.Next(allChannels.Count)];
                try
                {
                    await player.ChangeChannel(channel);
                }
                catch (NoAvailableSongsException)
                {
                    // It's OK here.
                    continue;
                }
                Validator.ValidateSong(player.CurrentSong);
            }
        }
    private Discovery loadDiscoveryFromNode(XmlNode node)
    {
        Discovery discovery = new Discovery();

        discovery.id   = XmlUtil.Get(node, "id", string.Empty);
        discovery.text = node.InnerText;

        return(discovery);
    }
        public void BeginSearch_CallsStartSearchOnSsdpOnce()
        {
            var mock = new Mock<ISsdp>();

            var disco = new Discovery(mock.Object);
            disco.BeginSearch();

            mock.Verify(ssdp => ssdp.StartSearch(), Times.Once());
        }
Exemple #20
0
    protected void RemoveDiscovery(Discovery discovery)
    {
        if (!Discoveries.ContainsKey(discovery.Id))
        {
            return;
        }

        Discoveries.Remove(discovery.Id);
    }
        public void EndSearch_CallsStopSearchWithAbortedOnSsdpOnce()
        {
            var mock = new Mock<ISsdp>();

            var disco = new Discovery(mock.Object);
            disco.EndSearch();

            mock.Verify(ssdp => ssdp.StopSearch(SearchStoppedReason.Aborted), Times.Once());
        }
Exemple #22
0
        static async Task <Gateway> Connect(string appName, ConnectionMode mode, Discovery discovery, TimeSpan operationTimeout,
                                            int maxRetryForThrottling, TimeSpan maxRetryWait)
        {
            var log  = Log.ForContext <CosmosContext>();
            var c    = new Connector(operationTimeout, maxRetryForThrottling, maxRetryWait, log, mode: mode);
            var conn = await FSharpAsync.StartAsTask(c.Connect(appName, discovery), null, null);

            return(new Gateway(conn, new BatchingPolicy(defaultMaxItems: 500)));
        }
        static async Task <Equinox.EventStore.EventStoreContext> Connect(EventStoreConfig config)
        {
            var c = new Connector(config.Username, config.Password, reqTimeout: TimeSpan.FromSeconds(5), reqRetries: 1);

            var conn = await FSharpAsync.StartAsTask(
                c.Establish("Twin", Discovery.NewGossipDns(config.Host), ConnectionStrategy.ClusterTwinPreferSlaveReads),
                null, null);

            return(new Equinox.EventStore.EventStoreContext(conn, new BatchingPolicy(maxBatchSize: 500)));
        }
        public DiscoveryDialog()
        {
            InitializeComponent();

            _discovery              = new Discovery();
            _discovery.DeviceFound += _discovery_DeviceFound;
            _discovery.DeviceLost  += _discovery_DeviceLost;
            _discovery.DeviceError += _discovery_DeviceError;
            _discovery.Start();
        }
Exemple #25
0
        public void GetBehaviors(out Discovery discovery, out Execution execution)
        {
            var discoveryType = DiscoveryType();
            var executionType = ExecutionType();

            discovery = (Discovery)Construct(discoveryType);
            execution = discoveryType == executionType
                ? (Execution)discovery
                : (Execution)Construct(executionType);
        }
Exemple #26
0
 public void SetDiscovered(bool discovered, Discovery d, MazeLevel maze)
 {
     _discovered      = discovered;
     this.maze        = maze;
     maze.seen[coord] = discovered;
     this.d           = d;
     t       = transform;
     started = 0;
     DoAnimate();
 }
Exemple #27
0
        /// <summary>
        /// Get specifico per la V3
        /// ToDo: testare!
        /// </summary>
        /// <param name="objectId">Id oggetto</param>
        /// <returns>SNMP message</returns>
        private ISnmpMessage GetMessageV3(string objectId)
        {
            return(null);

            ErrorString = "";

            //Discover
            Discovery     discovery = Messenger.GetNextDiscovery(SnmpType.GetRequestPdu);
            ReportMessage report;

            try
            {
                report = discovery.GetResponse(10000, new IPEndPoint(IpRequestManager, IpRequestPORT));
            }
            catch (Exception ex)
            {
                ErrorString = String.Format("Message: {0}\r\nSource: {1}\r\nStackTrace:{2}", ex.Message, ex.Source, ex.StackTrace);
                return(null);
            }

            GetRequestMessage request = new GetRequestMessage(
                VersionCode,
                Messenger.NextMessageId,
                Messenger.NextRequestId,
                UName,
                new List <Variable>
            {
                new Variable(new ObjectIdentifier(objectId))
            },
                Priv,
                Messenger.MaxMessageSize,
                report);

            ISnmpMessage reply;

            try
            {
                reply = request.GetResponse(10000, new IPEndPoint(IpRequestManager, IpRequestPORT));
            }
            catch (Exception ex)
            {
                ErrorString = String.Format("Message: {0}\r\nSource: {1}\r\nStackTrace:{2}", ex.Message, ex.Source, ex.StackTrace);
                return(null);
            }

            //if (reply.Pdu().ErrorStatus.ToInt32() != 0) // != ErrorCode.NoError
            //{
            //    throw ErrorException.Create(
            //        "error in response",
            //        IpRequestManager,
            //        reply);
            //}

            return(reply);
        }
Exemple #28
0
        internal void AddDiscoveryToInternalCache(string cacheKey, Discovery <TArachnodeDAO> discovery)
        {
            if (!_memoryManager.IsUsingDesiredMaximumMemoryInMegabytes(false))
            {
                HttpRuntime.Cache.Remove(cacheKey);

                HttpRuntime.Cache.Add(cacheKey, discovery, null, DateTime.MaxValue, TimeSpan.FromSeconds(_applicationSettings.DiscoverySlidingExpirationInSeconds), CacheItemPriority.Normal, _cacheItemRemovedCallback);

                Counters.GetInstance().DiscoveryAdded();
            }
        }
Exemple #29
0
    protected void AddDiscovery(Discovery discovery)
    {
        if (Discoveries.ContainsKey(discovery.Id))
        {
            return;
        }

        World.AddExistingDiscovery(discovery);

        Discoveries.Add(discovery.Id, discovery);
    }
Exemple #30
0
        public static void Run(Listener listener, Discovery discovery, Execution execution, params Type[] candidateTypes)
        {
            if (candidateTypes.Length == 0)
            {
                throw new InvalidOperationException("At least one type must be specified.");
            }

            var bus = new Bus(listener);

            new Runner(candidateTypes[0].Assembly, bus).Run(candidateTypes, discovery, execution);
        }
Exemple #31
0
 private void InitializeSingleton()
 {
     if (Singleton != null && Singleton != this)
     {
         Destroy(this);
     }
     else
     {
         Singleton = this;
     }
 }
Exemple #32
0
        public void Child_class_with_default_constructor_are_ok()
        {
            Action testDelegate = () =>
            {
                var testCase   = typeof(DiscoveryCases.DefaultConstructorOnDerivedClassSpec);
                var constuctor = Discovery.FindConfigConstructor(testCase);
                constuctor.Should().NotBeNull();
            };

            testDelegate.ShouldNotThrow();
        }
Exemple #33
0
        public static void RunTypes(Listener listener, Discovery discovery, Execution execution, params Type[] types)
        {
            if (types.Length == 0)
            {
                throw new InvalidOperationException("RunTypes requires at least one type to be specified");
            }

            var bus = new Bus(listener);

            new Runner(bus).RunTypes(types[0].Assembly, discovery, execution, types);
        }
Exemple #34
0
        public ClassRunner(Bus bus, Discovery discovery, Execution execution)
        {
            var config = discovery.Config;

            this.bus            = bus;
            this.execution      = execution;
            methodDiscoverer    = new MethodDiscoverer(discovery);
            parameterDiscoverer = new ParameterDiscoverer(discovery);

            orderMethods = config.OrderMethods;
        }
Exemple #35
0
    public bool HasDiscovery(string id)
    {
        Discovery discovery = GetDiscovery(id);

        if (discovery != null)
        {
            return(true);
        }

        return(false);
    }
Exemple #36
0
        private SoapMessage <object> ReceiveHelloMessage(
            string stepName,
            string noMessageText,
            int timeout)
        {
            Discovery discovery = new Discovery(_nic.IP);

            discovery.HelloReceived     += OnHelloReceived;
            discovery.ReceiveError      += OnDiscoveryError;
            discovery.DiscoveryFinished += OnDiscoveryFinished;
            _eventTimeout.Reset();
            _eventHelloReceived.Reset();
            _eventByeReceived.Reset();
            _eventDiscoveryError.Reset();

            SoapMessage <object> response = null;

            try
            {
                discovery.WaitHello(_cameraIp, _cameraId, timeout);
                RunStep(() =>
                {
                    int res = WaitForResponse(new WaitHandle[] {
                        _eventHelloReceived,
                        _eventByeReceived,
                        _eventDiscoveryError,
                        _eventTimeout
                    });
                    if (res == 0)
                    {
                        response = _message;
                        if (_message != null)
                        {
                            string dump = System.Text.Encoding.UTF8.GetString(_message.Raw);
                            LogResponse(dump);
                        }
                    }
                    else if (res == 2)
                    {
                        string message = _error.Message + _error.InnerException ?? " " + _error.InnerException.Message;
                        throw new AssertException(message);
                    }
                    else if (noMessageText != null)
                    {
                        throw new AssertException(noMessageText);
                    }
                }, stepName);
            }
            finally
            {
                discovery.Close();
            }
            return(response);
        }
Exemple #37
0
 void Start()
 {
     if (characterMover == null)
     {
         characterMover = GetComponent <CharacterMove>();
     }
     _t             = characterMover.transform;
     follower       = game.clickToMove.Follower(characterMover);
     discovery      = game.EnsureExplorer(characterMover.gameObject);
     visionParticle = GetComponentInChildren <ParticleSystem>();
 }
Exemple #38
0
        private void startEnum()
        {
            ManagedUPnP.Logging.LogLines += new LogLinesEventHandler(ManagedUPnPLog);
            ManagedUPnP.Logging.Enabled   = true;

            mdDiscovery = new Discovery(null, AddressFamilyFlags.IPv4, true);

            mdDiscovery.DeviceAdded    += new DeviceAddedEventHandler(mdDiscovery_DeviceAdded);
            mdDiscovery.SearchComplete += new SearchCompleteEventHandler(mdDiscovery_SearchComplete);
            mdDiscovery.Start();
        }
Exemple #39
0
        static void Main(string[] args)
        {
            var nodeIndex = CommandLine.GetInt32("multinode.index");
            var assemblyName = CommandLine.GetProperty("multinode.test-assembly");
            var typeName = CommandLine.GetProperty("multinode.test-class");
            var testName = CommandLine.GetProperty("multinode.test-method");
            var displayName = testName;

            Thread.Sleep(TimeSpan.FromSeconds(10));

            using (var controller = new XunitFrontController(assemblyName))
            {
                using (var discovery = new Discovery(assemblyName, typeName))
                {
                    using (var sink = new Sink(nodeIndex))
                    {
                        Thread.Sleep(10000);
                        try
                        {
                            controller.Find(true, discovery, TestFrameworkOptions.ForDiscovery());
                            discovery.Finished.WaitOne();
                            controller.RunTests(discovery.TestCases, sink, TestFrameworkOptions.ForExecution());
                        }
                        catch (AggregateException ex)
                        {
                            var specFail = new SpecFail(nodeIndex, displayName);
                            specFail.FailureExceptionTypes.Add(ex.GetType().ToString());
                            specFail.FailureMessages.Add(ex.Message);
                            specFail.FailureStackTraces.Add(ex.StackTrace);
                            foreach (var innerEx in ex.Flatten().InnerExceptions)
                            {
                                specFail.FailureExceptionTypes.Add(innerEx.GetType().ToString());
                                specFail.FailureMessages.Add(innerEx.Message);
                                specFail.FailureStackTraces.Add(innerEx.StackTrace);
                            }
                            Console.WriteLine(specFail);
                            Environment.Exit(1); //signal failure
                        }
                        catch (Exception ex)
                        {
                            var specFail = new SpecFail(nodeIndex, displayName);
                            specFail.FailureExceptionTypes.Add(ex.GetType().ToString());
                            specFail.FailureMessages.Add(ex.Message);
                            specFail.FailureStackTraces.Add(ex.StackTrace);
                            Console.WriteLine(specFail);
                            Environment.Exit(1); //signal failure
                        }
                        sink.Finished.WaitOne();
                        Environment.Exit(sink.Passed ? 0 : 1);
                    }
                }
            }
        }
        public async void TestSearchChannel(string query, int size)
        {
            var player = Generator.Player;
            var discovery = new Discovery(player.Session);
            var start = 0;
            var allChannels = new List<Channel>();
            int? totalCount = null;
            while (true)
            {
                var channels = await discovery.SearchChannel(query, start, size);
                Assert.IsNotNull(channels);
                Assert.IsNotNull(channels.CurrentList);
                Assert.IsNotNull(channels.TotalCount);
                Assert.Greater(channels.TotalCount.Value, 0);
                if (totalCount.HasValue)
                {
                    Assert.AreEqual(totalCount.Value, channels.TotalCount);
                }
                else
                {
                    totalCount = channels.TotalCount;
                }
                if (channels.CurrentList.Count == 0) break;
                foreach (var channel in channels.CurrentList)
                {
                    Validator.ValidateChannel(channel);
                }
                allChannels.AddRange(channels.CurrentList);
                start += size;
            }
            Assert.IsNotEmpty(allChannels);
            // Bug #16: seems the server doesn't always return all the channels. Maybe the server has some filter logic.
            //Assert.AreEqual(totalCount.Value, allChannels.Count);
            //Assert.GreaterOrEqual(start, totalCount.Value);

            var random = new Random();
            for (var i = 0; i < 5; ++i)
            {
                var channel = allChannels[random.Next(allChannels.Count)];
                try
                {
                    await player.ChangeChannel(channel);
                }
                catch (NoAvailableSongsException)
                {
                    // It's OK here.
                    continue;
                }
                Validator.ValidateSong(player.CurrentSong);
            }
        }
        public void SsdpRaisesDeviceFound_ResponseMissingService_NoItemsAddedToResults()
        {
            var mock = new Mock<ISsdp>();

            var disco = new Discovery(mock.Object);
            var ipEndpoint = new IPEndPoint(IPAddress.Parse("192.168.1.100"), 80);
            var resultDict = new Dictionary<string, string>()
                {
                    {"LOCATION", "http://192.168.1.204/sys/" }
                };
            mock.Raise(ssdp => ssdp.DeviceFound += null, new DeviceFoundEventArgs(ipEndpoint, resultDict));

            Assert.IsFalse(disco.Results.Any());
        }
        public void SsdpRaisesDeviceFound_ResponseMissingLocation_NoItemsAddedToResults()
        {
            var mock = new Mock<ISsdp>();

            var disco = new Discovery(mock.Object);
            var ipEndpoint = new IPEndPoint(IPAddress.Parse("192.168.1.100"), 80);
            var resultDict = new Dictionary<string, string>()
                {
                    {"SERVICE", "com.marvell.wm.system:1.0"},
                };
            mock.Raise(ssdp => ssdp.DeviceFound += null, new DeviceFoundEventArgs(ipEndpoint, resultDict));

            Assert.IsFalse(disco.Results.Any());
        }
        public void SsdpRaisesDeviceFound_ResponseIncludesServiceAndLocation_OneItemIsAddedToResults()
        {
            var mock = new Mock<ISsdp>();

            var disco = new Discovery(mock.Object);
            var ipEndpoint = new IPEndPoint(IPAddress.Parse("192.168.1.100"), 80);
            var resultDict = new Dictionary<string,string>()
                {
                    {"SERVICE", "com.marvell.wm.system:1.0"},
                    {"LOCATION", "http://192.168.1.204/sys/" }
                };
            mock.Raise(ssdp => ssdp.DeviceFound += null, new DeviceFoundEventArgs(ipEndpoint, resultDict));

            Assert.AreEqual(1, disco.Results.Count);
        }
        public async void TestGetSongDetail()
        {
            var serverConnectionMock = new Mock<IServerConnection>();
            serverConnectionMock.Setup(s => s.Get(It.Is<Uri>(u => u.AbsolutePath.EndsWith("song_detail")), It.IsAny<Action<HttpWebRequest>>())).ReturnsAsync(Resource.SongDetailExample).Verifiable();

            var discovery = new Discovery(new Session(serverConnectionMock.Object));
            var songDetail = await discovery.GetSongDetail("12345");
            Assert.IsNotNull(songDetail);
            Assert.IsNotEmpty(songDetail.ArtistChannels);
            foreach (var channel in songDetail.ArtistChannels)
            {
                Validator.ValidateChannel(channel);
            }
            Assert.IsTrue(songDetail.SimilarSongChannel.HasValue && songDetail.SimilarSongChannel.Value > 0);
            serverConnectionMock.Verify();
        }
 public DescribeRecordProcessorAccessor(Discovery service):
     base(service)
 {}
        public async void TestGetChannelInfo()
        {
            var serverConnectionMock = new Mock<IServerConnection>();
            serverConnectionMock.Setup(s => s.Get(It.Is<Uri>(u => u.AbsolutePath.EndsWith("channel_info")), It.IsAny<Action<HttpWebRequest>>())).ReturnsAsync(Resource.ChannelInfoExample).Verifiable();

            var discovery = new Discovery(new Session(serverConnectionMock.Object));
            var channel = await discovery.GetChannelInfo(123);
            Validator.ValidateChannel(channel);
            serverConnectionMock.Verify();
        }
        public async void TestGetLyrics()
        {
            var serverConnectionMock = new Mock<IServerConnection>();
            serverConnectionMock.Setup(s => s.Get(It.Is<Uri>(u => u.AbsolutePath.EndsWith("lyric")), It.IsAny<Action<HttpWebRequest>>())).ReturnsAsync(Resource.LyricsExample).Verifiable();

            var discovery = new Discovery(new Session(serverConnectionMock.Object));
            var lyrics = await discovery.GetLyrics("123", "12345");
            Assert.IsNotNull(lyrics);
            Assert.IsNotEmpty(lyrics);
        }
 protected override void StartDiscoverer(Discovery.ServiceDiscoverer discoverer, Guid guid)
 {
     discoverer.Start(ipAddress.ToString(), port, guid);
 }
        void ProcessRequest()
        {
            if (!string.IsNullOrEmpty(Request.QueryString["op"]))
            {
                if (Request.QueryString["op"] == "removedata")
                {

                    string network = Request.QueryString["network"];
                    string message = string.Empty;
                    var users = Request.QueryString["data[]"];
                    Messages mstable = new Messages();
                    DataSet ds = DataTableGenerator.CreateDataSetForTable(mstable);
                    DataTable dtt = ds.Tables[0];
                    string page = Request.QueryString["page"];
                    if (page == "feed")
                    {
                        AjaxFeed ajxfed = new AjaxFeed();
                        DataTable dt = null;
                        if (network == "facebook")
                        {
                            dt = (DataTable)Session["FacebookFeedDataTable"];
                        }
                        else if (network == "twitter")
                        {
                            dt = (DataTable)Session["TwitterFeedDataTable"];
                        }
                        else if (network == "linkedin")
                        {
                            dt = (DataTable)Session["LinkedInFeedDataTable"];
                        }

                        foreach (var parent in users)
                        {
                            DataView dv = new DataView(dtt);
                            DataRow[] foundRows = dt.Select("ProfileId = '" + parent + "'");
                            foreach (var child in foundRows)
                            {
                                dtt.ImportRow(child);
                            }
                        }
                        message = ajxfed.BindData(dtt);

                    }

                    else if (page == "message")
                    {
                        WooSuite.Message.AjaxMessage ajxmes = new WooSuite.Message.AjaxMessage();
                        DataSet dss = (DataSet)Session["MessageDataTable"];
                        //foreach (var parent in users)
                        //{
                        DataView dv = new DataView(dtt);
                        DataRow[] foundRows = dss.Tables[0].Select("ProfileId = '" + users + "'");
                        foreach (var child in foundRows)
                        {
                            dtt.ImportRow(child);
                        }

                        //}
                        message = ajxmes.BindData(dtt);
                    }
                    Response.Write(message);
                }
                else if (Request.QueryString["op"] == "upgradeplan")
                {
                    User user = (User)Session["LoggedUser"];
                    UserRepository userRepo = new UserRepository();
                    string accounttype = Request.QueryString["planid"];
                    if (accounttype == AccountType.Deluxe.ToString().ToLower())
                    {
                        userRepo.UpdateAccountType(user.Id, AccountType.Deluxe.ToString());
                        user.AccountType = AccountType.Deluxe.ToString();
                    }
                    else if (accounttype == AccountType.Standard.ToString().ToLower())
                    {
                        userRepo.UpdateAccountType(user.Id, AccountType.Standard.ToString());
                        user.AccountType = AccountType.Standard.ToString();
                    }
                    else if (accounttype == AccountType.Premium.ToString().ToLower())
                    {
                        userRepo.UpdateAccountType(user.Id, AccountType.Premium.ToString());
                        user.AccountType = AccountType.Premium.ToString();
                    }
                    Session["LoggedUser"] = user;

                }
                else if (Request.QueryString["op"] == "bindrssActive")
                {
                    User user = (User)Session["LoggedUser"];
                    RssFeedsRepository rssFeedsRepo = new RssFeedsRepository();
                    List<RssFeeds> lstrssfeeds = rssFeedsRepo.getAllActiveRssFeeds(user.Id);
                    TwitterAccountRepository twtAccountRepo = new TwitterAccountRepository();
                    if (lstrssfeeds != null)
                    {
                        if (lstrssfeeds.Count != 0)
                        {
                            int rssCount = 0;
                            string rssData = string.Empty;
                            rssData += "<h2 class=\"league section-ttl rss_header\">Active RSS Feeds</h2>";
                            foreach (RssFeeds item in lstrssfeeds)
                            {
                                TwitterAccount twtAccount = twtAccountRepo.getUserInformation(item.ProfileScreenName, user.Id);
                                string picurl = string.Empty;

                                if (string.IsNullOrEmpty(twtAccount.ProfileUrl))
                                {
                                    picurl = "../Contents/img/blank_img.png";

                                }
                                else
                                {
                                    picurl = twtAccount.ProfileUrl;

                                }
                                rssData +=

                                   " <section id=\"" + item.Id + "\" class=\"publishing\">" +
                                        "<section class=\"twothird\">" +
                                            "<article class=\"quarter\">" +
                                                "<div href=\"#\" class=\"avatar_link view_profile\" title=\"\">" +
                                                    "<img title=\"" + item.ProfileScreenName + "\" src=\"" + picurl + "\" data-src=\"\" class=\"avatar sm\">" +
                                                    "<article class=\"rss_ava_icon\"><span title=\"Twitter\" class=\"icon twitter_16\"></span></article>" +
                                                "</div>" +
                                            "</article>" +
                                            "<article class=\"threefourth\">" +
                                                "<ul>" +
                                                    "<li>" + item.FeedUrl + "</li>" +
                                                    "<li>Prefix: </li>" +
                                                    "<li class=\"freq\" title=\"New items from this feed will be posted at most once every hour\">Max Frequency: " + item.Duration + "</li>" +
                                                "</ul>" +
                                            "</article>" +
                                        "</section>" +
                                        "<section class=\"third\">" +
                                            "<ul class=\"rss_action_buttons\">" +
                                                "<li onclick=\"pauseFunction('" + item.Id + "');\" class=\"\"><a id=\"pause_" + item.Id + "\" href=\"#\" title=\"Pause\" class=\"small_pause icon pause\"></a></li>" +
                                                "<li onclick=\"deleteRssFunction('" + item.Id + "');\" class=\"show-on-hover\"><a id=\"delete_" + item.Id + "\" href=\"#\" title=\"Delete\" class=\"small_remove icon delete\"></a></li>" +
                                            "</ul>" +
                                        "</section>" +
                                     "</section>";
                            }
                            Response.Write(rssData);
                        }
                    }

                }

                else if (Request.QueryString["op"] == "savedrafts")
                {
                    Guid Id = Guid.Parse(Request.QueryString["id"]);
                    string newstr = Request.QueryString["newstr"];
                    DraftsRepository draftsRepo = new DraftsRepository();
                    draftsRepo.UpdateDrafts(Id, newstr);

                }
                else if (Request.QueryString["op"] == "getTwitterUserTweets")
                {
                    UrlExtractor urlext = new UrlExtractor();
                    User user = (User)Session["LoggedUser"];
                    string userid = Request.QueryString["profileid"];
                    TwitterAccountRepository twtAccountRepo = new TwitterAccountRepository();
                    ArrayList alst = twtAccountRepo.getAllTwitterAccountsOfUser(user.Id);
                    oAuthTwitter oauth = new oAuthTwitter();
                    foreach (TwitterAccount childnoe in alst)
                    {
                        oauth.AccessToken = childnoe.OAuthToken;
                        oauth.AccessTokenSecret = childnoe.OAuthSecret;
                        oauth.ConsumerKey = ConfigurationManager.AppSettings["consumerKey"];
                        oauth.ConsumerKeySecret = ConfigurationManager.AppSettings["consumerSecret"];
                        oauth.TwitterUserId = childnoe.TwitterUserId;
                        oauth.TwitterScreenName = childnoe.TwitterScreenName;
                        break;
                    }

                    TimeLine timeLine = new TimeLine();

                    //need to be implement waiting for design
                    string mes = string.Empty;
                    JArray userlookup = timeLine.Get_Statuses_User_Timeline(oauth,userid);
                    string jstring = string.Empty;
                    int i = 0;
                    foreach (var item in userlookup)
                    {

                        if (i < 2)
                        {
                            string[] str = urlext.splitUrlFromString(item["text"].ToString());
                            mes += "<li class=\"\">" +
                                              "<div class=\"twtcommands\">" +
            "<a class=\"account-group\">" +
                "<img class=\"avatar\" alt=\"\" src=\"" + item["user"]["profile_image_url"] + "\" alt=\"\" />" +
            "</a>" +
            "<div class=\"stream-item-header\">" +
                "<div class=\"user-details\">" +
                    "<strong class=\"fullname\">" + item["user"]["name"] + "</strong>" +
                    "<span class=\"username\">" +
                        "<s>@</s>" +
                        "<b>" + item["screen_name"] + "</b>" +
                    "</span>" +
                    "<small class=\"time\"></small>" +
                "</div><p class=\"tweet-text\">";

                            foreach (string substritem in str)
                            {
                                if (!string.IsNullOrEmpty(substritem))
                                {
                                    if (substritem.Contains("http"))
                                    {
                                        mes += "<a target=\"_blank\" href=\"" + substritem + "\">" + substritem + "</a>";
                                    }
                                    else
                                    {
                                        mes += substritem;
                                    }
                                }
                            }

                            //item["text"] " +
                            //"<a target=\"_blank\" class=\"twitter-timeline-link\" href=\"#\" f69e857af67d2c=\"true\">" +
                            //    "<span class=\"tco-ellipsis\"></span>" +
                            //    "<span class=\"invisible\">http://</span>" +
                            //    "<span class=\"js-display-url\">ow.ly/o4o7l</span>" +
                            //    "<span class=\"invisible\"></span>" +
                            //    "<span class=\"tco-ellipsis\"><span class=\"invisible\">&nbsp;</span></span>" +
                            //"</a>

                            mes += "</p>" +
                                 "<div class=\"details\">" +
                                     "<a class=\"stream_details\"></a>" +
                                 "</div>" +
                             "</div>" +
                       "</div>" +
                                                           "</li>";
                            i++;
                        }
                        else {
                            break;
                        }
                    }
                    Response.Write(mes);

                }
                else if (Request.QueryString["op"] == "saveWooQueue")
                {
                    Guid Id = Guid.Parse(Request.QueryString["id"]);
                    string profileid = Request.QueryString["profid"];
                    string message = Request.QueryString["message"];
                    string network = Request.QueryString["network"];
                    string net = string.Empty;

                    if (network == "fb")
                    {
                        net = "facebook";
                    }
                    else if (network == "twt")
                    {
                        net = "twitter";

                    }
                    else if (network == "lin")
                    {
                        net = "linkedin";
                    }
                    ScheduledMessageRepository schmsgRepo = new ScheduledMessageRepository();
                    schmsgRepo.UpdateProfileScheduleMessage(Id, profileid, message, net);

                }
                else if (Request.QueryString["op"] == "saveRss")
                {
                    try
                    {
                        User user = (User)Session["LoggedUser"];
                        RssFeedsRepository objRssFeedRepo = new RssFeedsRepository();
                        RssFeeds objRssFeeds = new RssFeeds();
                        objRssFeeds.ProfileScreenName = Request.QueryString["user"];
                        objRssFeeds.FeedUrl = Request.QueryString["feedsurl"];
                        objRssFeeds.UserId = user.Id;
                        objRssFeeds.Status = false;
                        objRssFeeds.Message = Request.QueryString["message"];
                        objRssFeeds.Duration = Request.QueryString["duration"];
                        objRssFeeds.CreatedDate = DateTime.Now;
                        objRssFeedRepo.AddRssFeed(objRssFeeds);
                    }
                    catch (Exception ex)
                    {
                        logger.Error(ex.Message);
                        Console.WriteLine(ex.Message);
                    }
                }
                else if (Request.QueryString["op"] == "deletewooqueuemessage")
                {
                    try
                    {
                        Guid id = Guid.Parse(Request.QueryString["id"]);
                        ScheduledMessageRepository schmsgRepo = new ScheduledMessageRepository();
                        schmsgRepo.deleteMessage(id);
                    }
                    catch (Exception ex)
                    {
                        logger.Error(ex.Message);
                    }
                }
                else if (Request.QueryString["op"] == "chkrssurl")
                {
                    try
                    {
                        string url = Request.QueryString["url"];
                        var facerequest = (HttpWebRequest)WebRequest.Create(url);
                        facerequest.Method = "GET";
                        string outputface = string.Empty;
                        using (var response = facerequest.GetResponse())
                        {
                            using (var stream = new StreamReader(response.GetResponseStream(), Encoding.GetEncoding(1252)))
                            {
                                outputface = stream.ReadToEnd();
                                if (outputface.Contains("<rss version=\"2.0\""))
                                {
                                    Response.Write("true");
                                }
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        logger.Error(ex.Message);
                        Console.WriteLine(ex.Message);
                        Response.Write("Error");
                    }

                }
                else if (Request.QueryString["op"] == "rssusers")
                {
                    try
                    {
                        User user = (User)Session["LoggedUser"];
                        TwitterAccountRepository twtAccRepo = new TwitterAccountRepository();
                        ArrayList alst = twtAccRepo.getAllTwitterAccountsOfUser(user.Id);
                        string message = string.Empty;
                        foreach (TwitterAccount item in alst)
                        {
                            message += "<option value=\"" + item.TwitterScreenName + "\">@" + item.TwitterScreenName + "</option>";
                        }
                        Response.Write(message);
                    }
                    catch (Exception ex)
                    {
                        logger.Error(ex.Message);
                        Console.WriteLine(ex.Message);
                    }

                }
                else if (Request.QueryString["op"] == "searchkeyword")
                {
                    User user = (User)Session["LoggedUser"];
                    DiscoverySearchRepository disrepo = new DiscoverySearchRepository();
                    List<string> alst = disrepo.getAllSearchKeywords(user.Id);
                    string message = string.Empty;

                    foreach (var item in alst)
                    {
                        message += "<li onclick=\"getSearchResults('" + item + "');\"><a href=\"#\"><i class=\"show icon-caret-right\" style=\"visibility:visible;margin-right:5px\"></i>" + item + "</a></li>";
                    }
                    Response.Write(message);

                }
                else if (Request.QueryString["op"] == "getResults")
                {
                    string type = Request.QueryString["type"];
                    string key = Request.QueryString["keyword"];
                    Discovery discoverypage = new Discovery();
                    string search = discoverypage.getresults(key);
                    string message = "<ul id=\"message-list\">" + search + "</ul>";
                    Response.Write(message);
                }
                else if (Request.QueryString["op"] == "getFollowers")
                {
                    User user = (User)Session["LoggedUser"];
                    Users twtUser = new Users();
                    oAuthTwitter oauth = new oAuthTwitter();
                    TwitterAccountRepository TwtAccRepo = new TwitterAccountRepository();
                    TwitterAccount TwtAccount = TwtAccRepo.getUserInformation(user.Id, Request.QueryString["id"]);
                    oauth.AccessToken = TwtAccount.OAuthToken;
                    oauth.AccessTokenSecret = TwtAccount.OAuthSecret;
                    oauth.ConsumerKey = ConfigurationManager.AppSettings["consumerKey"];
                    oauth.ConsumerKeySecret = ConfigurationManager.AppSettings["consumerSecret"];
                    oauth.TwitterScreenName = TwtAccount.TwitterScreenName;
                    oauth.TwitterUserId = TwtAccount.TwitterUserId;
                    JArray response = twtUser.Get_Followers_ById(oauth, Request.QueryString["id"]);

                    string jquery = string.Empty;

                    foreach (var item in response)
                    {
                        if (item["ids"] != null)
                        {
                            foreach (var child in item["ids"])
                            {
                                JArray userprofile = twtUser.Get_Users_LookUp(oauth, child.ToString());
                                foreach (var items in userprofile)
                                {

                                    try
                                    {

                                        jquery += "<li class=\"shadower\">" +
                                              "<div class=\"disco-feeds\">" +
                                                  "<div class=\"star-ribbon\"></div>" +
                                                  "<div class=\"disco-feeds-img\">" +
                                                      "<img alt=\"\" src=\"" + items["profile_image_url"] + "\" style=\"height: 100px; width: 100px;\" class=\"pull-left\">" +
                                                  "</div>" +
                                                  "<div class=\"disco-feeds-content\">" +
                                                      "<div class=\"disco-feeds-title\">" +
                                                          "<h3 class=\"no-margin\">" + items["name"] + "</h3>" +
                                                          "<span>@" + items["screen_name"] + "</span>" +
                                                      "</div>" +
                                                      "<p>";

                                        try
                                        {
                                            jquery += items["status"]["text"];
                                        }
                                        catch (Exception ex)
                                        {
                                            logger.Error(ex.Message);
                                        }

                                        jquery += "</p>" +
                                            //"<a href=\"#\" class=\"btn\">Hide</a>" +
                                          "<a href=\"#\" onclick=\"detailsprofile('" + items["id_str"] + "')\" class=\"btn\">Full Profile <i class=\"icon-caret-right\"></i> </a><div class=\"scl\">" +
                                          "<a href=\"#\"><img alt=\"\" src=\"../Contents/img/admin/usergrey.png\"></a>" +
                                          "<a href=\"#\"><img alt=\"\" src=\"../Contents/img/admin/goto.png\"></a>" +
                                          "<a href=\"#\"><img alt=\"\" src=\"../Contents/img/admin/setting.png\"></a>" +
                                      "</div></div></div>" +
                                  "<div class=\"disco-feeds-info\">" +
                                      "<ul class=\"no-margin\">" +
                                          "<li><a href=\"#\"><img src=\"../Contents/img/admin/markerbtn2.png\" alt=\"\">";

                                        if (!string.IsNullOrEmpty(items["time_zone"].ToString()))
                                        {
                                            jquery += items["time_zone"];
                                        }
                                        else
                                        {
                                            jquery += "Not Specific";
                                        }
                                        jquery += "</a></li>";

                                        if (string.IsNullOrEmpty(items["url"].ToString()))
                                        {
                                            jquery += "<li><a href=\"#\"><img src=\"../Contents/img/admin/url.png\" alt=\"\">";
                                            jquery += "Not Specific";
                                        }
                                        else
                                        {
                                            jquery += "<li><a target=\"_blank\" href=\"" + items["url"] + "\"><img src=\"../Contents/img/admin/url.png\" alt=\"\">";
                                            jquery += items["url"];
                                        }
                                        jquery += "</a></li></ul>" +
                                        "<ul class=\"no-margin\" style=\"margin-top:20px\">" +
                                            "<li><a href=\"#\"><img src=\"../Contents/img/admin/twittericon-white.png\" alt=\"\">Followers <big><b>" + items["followers_count"] + "</b></big></a></li>" +
                                            "<li><a href=\"#\"><img src=\"../Contents/img/admin/twitter-white.png\" alt=\"\">Following <big><b>" + items["friends_count"] + "</b></big></a></li>" +
                                            "</ul>" +
                                    "</div>" +
                                "</li>";

                                        #region old
                                        //            jquery += "<div class=\"wentbg\">" +
                                        //                          "<div class=\"over\">" +
                                        //                            "<div class=\"topicon\">" +
                                        //                //"<a href=\"#\"><img border=\"none\" alt=\"\" src=\"../Contents/img/manplus.png\"></a>" +
                                        //                //"<a href=\"#\"><img border=\"none\" alt=\"\" src=\"../Contents/img/replay.png\"></a>" +
                                        //                //"<a href=\"#\"><img border=\"none\" alt=\"\" src=\"../Contents/img/setting.png\"></a>" +
                                        //                            "</div>" +
                                        //                                  "<div class=\"botombtn\">" +
                                        //                              "<div class=\"clickbtn\"><a href=\"#\"><img border=\"none\" alt=\"\" src=\"../Contents/img/full_profile.png\" onclick=\"detailsprofile('" + items["id_str"] + "')\"></a></div>" +
                                        //                            "</div>" +
                                        //                            "</div>" +
                                        //                                   "<div class=\"wentbgf\"><img alt=\"\" src=\"" + items["profile_image_url"] + "\"></div>" +

                                        //                                            "<div class=\"wentbgtext\">" +
                                        //"<span class=\"heading\">\"" + items["name"] + "\"</span> <span>@\"" + items["screen_name"] + "\"</span>" +
                                        //"<div class=\"viegil\">\"" + items["status"]["text"] + "\"</div>" +

                                        //            "<div class=\"avenue\">" +
                                        //             "<img alt=\"\" src=\"../Contents/img/avenue.png\">" +
                                        //             "<div class=\"avenuetext\">\"" + items["time_zone"] + "\"</div>" +
                                        //              "<img class=\"link\" alt=\"\" src=\"../Contents/img/url.png\">" +
                                        //             "<div class=\"nourl\">No URL</div>" +
                                        //         "</div>";

                                        //            jquery += "<div class=\"followerbg\">" +
                                        //                     "<div class=\"follower\">Followers <span>\"" + items["followers_count"] + "\"</span></div>" +
                                        //                     "<div class=\"following\">Friends <span>\"" + items["friends_count"] + "\"</span></div>" +
                                        //                  "</div>" +
                                        //              "</div>" +
                                        //          "</div>";
                                        #endregion
                                    }
                                    catch (Exception ex)
                                    {
                                        logger.Error(ex.Message);
                                        Console.WriteLine(ex.Message);
                                    }
                                }
                            }
                        }
                        else
                        {
                            jquery += "None of the User Is Following";
                        }

                    }

                    Response.Write(jquery);
                }
                else if (Request.QueryString["op"] == "deletedrafts")
                {
                    Guid id = Guid.Parse(Request.QueryString["id"]);
                    DraftsRepository draftsRepo = new DraftsRepository();
                    draftsRepo.DeleteDrafts(id);

                }
                else if (Request.QueryString["op"] == "usersearchresults")
                {
                    ArrayList alstallusers = null;
                    if (Session["AllUserList"] == null)
                    {
                        User user = (User)Session["LoggedUser"];
                        alstallusers = new ArrayList();

                        /*facebook*/
                        try
                        {
                            FacebookAccountRepository faceaccount = new FacebookAccountRepository();
                            ArrayList lstfacebookaccount = faceaccount.getAllFacebookAccountsOfUser(user.Id);
                            foreach (FacebookAccount item in lstfacebookaccount)
                            {
                                alstallusers.Add(item.FbUserName + "_fb_" + item.FbUserId);
                            }
                        }
                        catch (Exception ex)
                        {
                            logger.Error(ex.Message);
                            Console.WriteLine(ex.Message);
                        }

                        /*twitter*/
                        try
                        {
                            TwitterAccountRepository twtAccountrepo = new TwitterAccountRepository();
                            ArrayList lsttwitteraccount = twtAccountrepo.getAllTwitterAccountsOfUser(user.Id);

                            foreach (TwitterAccount item in lsttwitteraccount)
                            {
                                alstallusers.Add(item.TwitterScreenName + "_twt_" + item.TwitterUserId);
                            }

                        }
                        catch (Exception ex)
                        {
                            logger.Error(ex.Message);
                            Console.WriteLine(ex.Message);
                        }

                        /*linkedin*/
                        try
                        {
                            LinkedInAccountRepository linkedinaccountrepo = new LinkedInAccountRepository();
                            ArrayList lstaccount = linkedinaccountrepo.getAllLinkedinAccountsOfUser(user.Id);

                            foreach (LinkedInAccount item in lstaccount)
                            {
                                alstallusers.Add(item.LinkedinUserName + "_lin_" + item.LinkedinUserId);
                            }

                        }
                        catch (Exception ex)
                        {
                            logger.Error(ex.Message);
                            Console.WriteLine(ex.Message);
                        }
                        /*instagram*/
                        try
                        {
                            InstagramAccountRepository instaaccrepo = new InstagramAccountRepository();
                            ArrayList lstinstagramaccount = instaaccrepo.getAllInstagramAccountsOfUser(user.Id);
                            foreach (InstagramAccount item in lstinstagramaccount)
                            {
                                alstallusers.Add(item.InsUserName + "_ins_" + item.InstagramId);
                            }
                        }
                        catch (Exception ex)
                        {
                            logger.Error(ex.Message);
                            Console.WriteLine(ex.Message);
                        }

                        ///*googleplus*/
                        try
                        {
                            GooglePlusAccountRepository gpaccountrepo = new GooglePlusAccountRepository();
                            ArrayList lstgpaccount = gpaccountrepo.getAllGooglePlusAccountsOfUser(user.Id);
                            foreach (GooglePlusAccount item in lstgpaccount)
                            {
                                alstallusers.Add(item.GpUserName + "_gp_" + item.GpUserId);
                            }
                        }
                        catch (Exception ex)
                        {
                            logger.Error(ex.Message);
                            Console.WriteLine(ex.Message);
                        }

                        Session["AllUserList"] = alstallusers;
                    }
                    else
                    {
                        alstallusers = (ArrayList)Session["AllUserList"];
                    }

                }
                else if (Request.QueryString["op"] == "searchingresults")
                {
                    string txtvalue = Request.QueryString["txtvalue"];
                    string message = string.Empty;
                    if (!string.IsNullOrEmpty(txtvalue))
                    {
                        ArrayList alstall = (ArrayList)Session["AllUserList"];

                        if (alstall.Count != 0)
                        {
                            foreach (string item in alstall)
                            {
                                if (item.ToLower().StartsWith(txtvalue))
                                {
                                    string[] nametype = item.Split('_');

                                    if (nametype[1] == "fb")
                                    {
                                        message += "<div  class=\"btn srcbtn\">" +
                                                        "<img width=\"15\" src=\"../Contents/img/facebook.png\" alt=\"\">" +
                                                  "<span onclick=\"getFacebookProfiles('" + nametype[2] + "')\">" + nametype[0] + "</span>" +
                                                   "<span data-dismiss=\"alert\" class=\"close pull-right\">×</span>" +
                                                   "</div>";
                                    }
                                    else if (nametype[1] == "twt" || item.Contains("_twt_"))
                                    {
                                        if (nametype.Count() < 4)
                                        {
                                            message += "<div class=\"btn srcbtn\">" +
                                                          "<img width=\"15\" src=\"../Contents/img/twticon.png\" alt=\"\">" +
                                                            " <span onclick=\"detailsprofile('" + nametype[0] + "');\">" + nametype[0] + "</span>" +
                                                     "<span data-dismiss=\"alert\" class=\"close pull-right\">×</span>" +
                                                             "</div>";
                                        }
                                        else
                                        {
                                            string[] containstwitter = item.Split(new string[] { "_twt_" }, StringSplitOptions.None);

                                            message += "<div  class=\"btn srcbtn\">" +
                                                             "<img width=\"15\" src=\"../Contents/img/twticon.png\" alt=\"\">" +
                                                                "<span onclick=\"detailsprofile('" + containstwitter[0] + "');\"> " + containstwitter[0] + "</span>" +
                                                        "<span data-dismiss=\"alert\" class=\"close pull-right\">×</span>" +
                                                                "</div>";

                                        }
                                    }
                                    else if (nametype[1] == "ins")
                                    {
                                        message += "<div class=\"btn srcbtn\">" +
                                                      "<img width=\"15\" src=\"../Contents/img/instagram_24X24.png\" alt=\"\">" +
                                                 nametype[0] +
                                                 "<span data-dismiss=\"alert\" class=\"close pull-right\">×</span>" +
                                                 "</div>";
                                    }
                                    else if (nametype[1] == "lin")
                                    {
                                        message += "<div class=\"btn srcbtn\">" +
                                                      "<img width=\"15\" src=\"../Contents/img/link_icon.png\" alt=\"\">" +
                                                 nametype[0] +
                                                 "<span data-dismiss=\"alert\" class=\"close pull-right\">×</span>" +
                                                 "</div>";
                                    }
                                    else if (nametype[1] == "gp")
                                    {
                                        message += "<div class=\"btn srcbtn\">" +
                                                          "<img width=\"15\" src=\"../Contents/img/google_plus.png\" alt=\"\">" +
                                                     nametype[0] +
                                                     "<span data-dismiss=\"alert\" class=\"close pull-right\">×</span>" +
                                                     "</div>";

                                    }
                                }

                            }
                        }
                        else
                        {
                            message += "<div class=\"btn srcbtn\">" +
                                                  "<img width=\"15\" src=\"../Contents/img/norecord.png\" alt=\"\">" +
                                             "No Records Found" +
                                             "<span data-dismiss=\"alert\" class=\"close pull-right\">×</span>" +
                                             "</div>";

                        }

                        message += "<div class=\"socailtile\">Twitter</div>";

                        /*twitter contact search */

                        #region twitter contact search
                        try
                        {
                            User user = (User)Session["LoggedUser"];
                            Users twtUser = new Users();
                            oAuthTwitter oAuthTwt = new oAuthTwitter();
                            if (Session["oAuthUserSearch"] == null)
                            {
                                oAuthTwitter oauth = new oAuthTwitter();
                                oauth.ConsumerKey = ConfigurationManager.AppSettings["consumerKey"].ToString();
                                oauth.ConsumerKeySecret = ConfigurationManager.AppSettings["consumerSecret"].ToString();
                                oauth.CallBackUrl = ConfigurationManager.AppSettings["callbackurl"].ToString();
                                TwitterAccountRepository twtAccRepo = new TwitterAccountRepository();
                                ArrayList alst = twtAccRepo.getAllTwitterAccountsOfUser(user.Id);
                                foreach (TwitterAccount item in alst)
                                {
                                    oauth.AccessToken = item.OAuthToken;
                                    oauth.AccessTokenSecret = item.OAuthSecret;
                                    oauth.TwitterUserId = item.TwitterUserId;
                                    oauth.TwitterScreenName = item.TwitterScreenName;
                                    break;
                                }
                                Session["oAuthUserSearch"] = oauth;
                                oAuthTwt = oauth;
                            }
                            else
                            {
                                oAuthTwitter oauth = (oAuthTwitter)Session["oAuthUserSearch"];
                                oAuthTwt = oauth;
                            }

                            JArray twtuserjson = twtUser.Get_Users_Search(oAuthTwt, txtvalue, "5");

                            foreach (var item in twtuserjson)
                            {
                                message += "<div class=\"btn srcbtn\">" +
                                                         "<img width=\"15\" src=\"../Contents/img/twticon.png\" alt=\"\">" +
                                                           " <span> " + item["screen_name"].ToString().TrimStart('"').TrimEnd('"') + "</span>" +
                                                    "<span data-dismiss=\"alert\" class=\"close pull-right\">×</span>" +
                                                            "</div>";
                            }

                        }
                        catch (Exception ex)
                        {
                            logger.Error(ex.Message);
                            Console.WriteLine(ex.Message);
                        }

                        #endregion

                        message += "<div class=\"socailtile\">Facebook</div>";

                        #region Facebook Contact search
                        try
                        {
                            string accesstoken = string.Empty;
                            FacebookAccountRepository facebookaccrepo = new FacebookAccountRepository();
                            ArrayList alstfacbookusers = facebookaccrepo.getAllFacebookAccounts();

                            foreach (FacebookAccount item in alstfacbookusers)
                            {
                                accesstoken = item.AccessToken;
                                break;
                            }

                            string facebookSearchUrl = "https://graph.facebook.com/search?q=" + txtvalue + " &limit=5&type=user&access_token=" + accesstoken;
                            var facerequest = (HttpWebRequest)WebRequest.Create(facebookSearchUrl);
                            facerequest.Method = "GET";
                            string outputface = string.Empty;
                            using (var response = facerequest.GetResponse())
                            {
                                using (var stream = new StreamReader(response.GetResponseStream(), Encoding.GetEncoding(1252)))
                                {
                                    outputface = stream.ReadToEnd();
                                }
                            }
                            if (!outputface.StartsWith("["))
                                outputface = "[" + outputface + "]";

                            JArray facebookSearchResult = JArray.Parse(outputface);

                            foreach (var item in facebookSearchResult)
                            {
                                var data = item["data"];
                                foreach (var chlid in data)
                                {
                                    message += "<div  class=\"btn srcbtn\">" +
                                                        "<img width=\"15\" src=\"../Contents/img/facebook.png\" alt=\"\">" +
                                                  "<span >" + chlid["name"] + "</span>" +
                                                   "<span data-dismiss=\"alert\" class=\"close pull-right\">×</span>" +
                                                   "</div>";
                                }

                            }

                        }
                        catch (Exception ex)
                        {
                            logger.Error(ex.Message);
                            Console.WriteLine(ex.Message);
                        }
                        #endregion

                        Response.Write(message);
                    }
                }
                else if (Request.QueryString["op"] == "getTwitterUserDetails")
                {
                    User user = (User)Session["LoggedUser"];
                    string userid = Request.QueryString["profileid"];
                    TwitterAccountRepository twtAccountRepo = new TwitterAccountRepository();
                    ArrayList alst = twtAccountRepo.getAllTwitterAccountsOfUser(user.Id);
                    oAuthTwitter oauth = new oAuthTwitter();
                    foreach (TwitterAccount childnoe in alst)
                    {
                        oauth.AccessToken = childnoe.OAuthToken;
                        oauth.AccessTokenSecret = childnoe.OAuthSecret;
                        oauth.ConsumerKey = ConfigurationManager.AppSettings["consumerKey"];
                        oauth.ConsumerKeySecret = ConfigurationManager.AppSettings["consumerSecret"];
                        oauth.TwitterUserId = childnoe.TwitterUserId;
                        oauth.TwitterScreenName = childnoe.TwitterScreenName;
                        break;
                    }

                    Users userinfo = new Users();
                    //JArray foll = userinfo.Get_Followers_ById(oauth, userid);
                    JArray userlookup = userinfo.Get_Users_LookUp(oauth, userid);
                    string jstring = string.Empty;
                    foreach (var item in userlookup)
                    {
                        jstring += "<div class=\"modal-small draggable\">";
                        jstring += "<div class=\"modal-content\">";
                        jstring += "<button class=\"modal-btn button b-close\" type=\"button\">";
                        jstring += "<span class=\"icon close-medium\"><span class=\"visuallyhidden\">X</span></span></button>";
                        jstring += "<div class=\"modal-header\"><h3 class=\"modal-title\">Profile summary</h3></div>";
                        jstring += "<div class=\"modal-body profile-modal\">";
                        jstring += "<div class=\"module profile-card component profile-header\">";
                        jstring += "<div class=\"profile-header-inner flex-module clearfix\" style=\"background-image: url('" + item["profile_banner_url"] + "');\">";
                        jstring += "<div class=\"profile-header-inner-overlay\"></div>";
                        jstring += "<a class=\"profile-picture media-thumbnail js-nav\" href=\"#\"><img class=\"avatar size73\" alt=\"" + item["name"] + "\" src=\"" + item["profile_image_url"] + "\" /></a>";
                        jstring += "<div class=\"profile-card-inner\">";
                        jstring += "<h1 class=\"fullname editable-group\">";
                        jstring += "<a href=\"#\" class=\"js-nav\">" + item["name"] + "</a>";
                        jstring += "<a class=\"verified-link js-tooltip\" href=\"#\"><span class=\"icon verified verified-large-border\"><span class=\"visuallyhidden\"></span> </span></a>";
                        jstring += "</h1>";
                        jstring += "<h2 class=\"username\"><a href=\"#\" class=\"pretty-link js-nav\"><span class=\"screen-name\"><s>@</s>" + item["screen_name"] + "</span> </a></h2>";
                        jstring += "<div class=\"bio-container editable-group\"><p class=\"bio profile-field\">";
                        try
                        {
                            jstring += item["status"]["text"];
                        }
                        catch (Exception ex) { logger.Error(ex.Message); }

                        jstring += "</p></div>";
                        jstring += "<p class=\"location-and-url\">";
                        jstring += "<span class=\"location-container editable-group\"><span class=\"location profile-field\"></span></span>";
                        jstring += "<span class=\"divider hidden\"></span> ";
                        jstring += "<span class=\"url editable-group\">  <span class=\"profile-field\"><a title=\"#\" href=\"" + item["url"] + "\" rel=\"me nofollow\" target=\"_blank\">" + item["url"] + " </a>";
                        jstring += "<div style=\"cursor: pointer; width: 16px; height: 16px; display: inline-block;\">&nbsp;</div>";
                        jstring += "</span></span></p></div></div>";
                        jstring += "<div class=\"clearfix\">";
                        jstring += "<div class=\"default-footer\">";
                        jstring += "<ul class=\"stats js-mini-profile-stats\">" +
                            //"<li><a href=\"#\" class=\"js-nav\"><strong> 6,274</strong> Tweets </a></li>" +
                                          "<li><a href=\"#\" class=\"js-nav\"><strong>" + item["friends_count"] + "</strong> Following </a></li>" +
                                          "<li><a href=\"#\" class=\"js-nav\"><strong>" + item["followers_count"] + "</strong> Followers </a></li>";
                        jstring += "</ul>";
                        jstring += "<div class=\"btn-group\">" +
                                      "<div class=\"follow_button\">";
                        //"<span class=\"button-text follow-text\">Follow</span> " +

                        //foreach (var child in foll)
                        //{
                        //    foreach (var childItem in child["ids"])
                        //    {
                        //        string pl = childItem.ToString();
                        //    }
                        //}

                        //jstring += "<span class=\"button-text follow-text\">Following</span>";
                        //jstring += "<span class=\"button-text unfollow-text\">Unfollow</span>";

                        jstring += "</div>" +
                              "</div>";
                        jstring += "</div></div>";
                        jstring += "<div class=\"profile-social-proof\"><div class=\"follow-bar\"></div></div></div>";
                        jstring += "<ol id=\"twitterUserTweets\" class=\"recent-tweets\">" +

                                  "</ol>" +
                                  "<div class=\"go_to_profile\">" +
                                      "<small><a href=\"https://twitter.com/" + item["screen_name"] + "\" target=\"_blank\" class=\"view_profile\">Go to full profile →</a></small>" +
                                  "</div>" +
                              "</div>" +
                              "<div class=\"loading\">" +
                                  "<span class=\"spinner-bigger\"></span>" +
                              "</div>" +
                          "</div>";
                        jstring += "</div>";
                    }
                    Response.Write(jstring);
                }
                else if (Request.QueryString["op"] == "pauseRssMessage")
                {
                    Guid ID = Guid.Parse(Request.QueryString["id"]);
                    RssFeedsRepository rssRepo = new RssFeedsRepository();
                    rssRepo.updateFeedStatus("pause", ID);
                }
                else if (Request.QueryString["op"] == "deleteRssMessage")
                {
                    Guid ID = Guid.Parse(Request.QueryString["id"]);
                    RssFeedsRepository rssRepo = new RssFeedsRepository();
                    rssRepo.DeleteRssMessage(ID);
                }
                else if (Request.QueryString["op"] == "playRssMessage")
                {
                    Guid ID = Guid.Parse(Request.QueryString["id"]);
                    RssFeedsRepository rssRepo = new RssFeedsRepository();
                    rssRepo.updateFeedStatus("play", ID);
                }
                else if (Request.QueryString["op"] == "facebookProfileDetails")
                {
                    User user = (User)Session["LoggedUser"];
                    string userid = Request.QueryString["profileid"];
                    FacebookAccountRepository fbRepo = new FacebookAccountRepository();
                    ArrayList alst = fbRepo.getAllFacebookAccountsOfUser(user.Id);
                    string accesstoken = string.Empty;

                    foreach (FacebookAccount childnoe in alst)
                    {
                        accesstoken = childnoe.AccessToken;

                        break;
                    }

                    FacebookClient fbclient = new FacebookClient(accesstoken);
                    string jstring = string.Empty;
                    dynamic item = fbclient.Get(userid);

                    jstring += "<div class=\"modal-small draggable\">";
                    jstring += "<div class=\"modal-content\">";
                    jstring += "<button class=\"modal-btn button b-close\" type=\"button\">";
                    jstring += "<span class=\"icon close-medium\"><span class=\"visuallyhidden\">X</span></span></button>";
                    jstring += "<div class=\"modal-header\"><h3 class=\"modal-title\">Profile summary</h3></div>";
                    jstring += "<div class=\"modal-body profile-modal\">";
                    jstring += "<div class=\"module profile-card component profile-header\">";

                    try
                    {
                        jstring += "<div class=\"profile-header-inner flex-module clearfix\" style=\"background-image: url('" + item["cover"]["source"] + "');\">";
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex.Message);
                        jstring += "<div class=\"profile-header-inner flex-module clearfix\" style=\"background-image: url('https://pbs.twimg.com/profile_banners/215936249/1371721359');\">";
                    }
                    jstring += "<div class=\"profile-header-inner-overlay\"></div>";
                    jstring += "<a class=\"profile-picture media-thumbnail js-nav\" href=\"#\"><img class=\"avatar size73\" alt=\"" + item["name"] + "\" src=\"http://graph.facebook.com/" + item["id"] + "/picture?type=small\" /></a>";
                    jstring += "<div class=\"profile-card-inner\">";
                    jstring += "<h1 class=\"fullname editable-group\">";
                    try
                    {
                        jstring += "<a href=\"#\" class=\"js-nav\">" + item["name"] + "</a>";
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex.StackTrace);
                    }
                    jstring += "<a class=\"verified-link js-tooltip\" href=\"#\"><span class=\"icon verified verified-large-border\"><span class=\"visuallyhidden\"></span> </span></a>";
                    jstring += "</h1>";
                    try
                    {
                        jstring += "<h2 class=\"username\"><a href=\"#\" class=\"pretty-link js-nav\"><span class=\"screen-name\"><s>@</s>" + item["username"] + "</span> </a></h2>";
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex.StackTrace);
                    }
                    jstring += "<div class=\"bio-container editable-group\"><p class=\"bio profile-field\">";
                    try
                    {
                        jstring += item["about"];
                    }
                    catch (Exception ex) { logger.Error(ex.Message); }

                    jstring += "</p></div>";
                    jstring += "<p class=\"location-and-url\">";
                    jstring += "<span class=\"location-container editable-group\"><span class=\"location profile-field\"></span></span>";
                    jstring += "<span class=\"divider hidden\"></span> ";
                    jstring += "<span class=\"url editable-group\">  <span class=\"profile-field\"><a title=\"#\" href=\"http://facebook.com/" + item["id"] + "\" rel=\"me nofollow\" target=\"_blank\">" + item["link"] + " </a>";
                    jstring += "<div style=\"cursor: pointer; width: 16px; height: 16px; display: inline-block;\">&nbsp;</div>";
                    jstring += "</span></span></p></div></div>";
                    jstring += "<div class=\"clearfix\">";
                    jstring += "<div class=\"default-footer\">";

                    jstring += "<div class=\"btn-group\">" +
                                  "<div class=\"follow_button\">" +

                                      //"<span class=\"button-text following-text\">Following</span>" +
                                      //"<span class=\"button-text unfollow-text\">Unfollow</span>" +
                                  "</div>" +
                               "</div>";
                    jstring += "</div></div>";
                    jstring += "<div class=\"profile-social-proof\"><div class=\"follow-bar\"></div></div></div>";
                    jstring += "<ol class=\"recent-tweets\">" +
                                  "<li class=\"\">" +
                                      "<div>" +
                                        "<i class=\"dogear\"></i>" +

                                      "</div>" +
                                  "</li>" +
                              "</ol>" +
                              "<div class=\"go_to_profile\">" +
                                  "<small><a href=\"http://facebook.com/" + item["id"] + "\" target=\"_blank\" class=\"view_profile\">Go to full profile →</a></small>" +
                              "</div>" +
                          "</div>" +
                          "<div class=\"loading\">" +
                              "<span class=\"spinner-bigger\"></span>" +
                          "</div>" +
                      "</div>";
                    jstring += "</div>";

                    Response.Write(jstring);

                }
            }
        }
        public async void TestGetSongDetail(string query)
        {
            var player = Generator.Player;
            var discovery = new Discovery(player.Session);
            var channels = await discovery.SearchChannel(query, 0, 1);
            Assert.IsNotNull(channels);
            Assert.AreEqual(1, channels.CurrentList.Count);
            Assert.GreaterOrEqual(channels.TotalCount, 1);
            var channel = channels.CurrentList[0];
            Validator.ValidateChannel(channel);
            await player.ChangeChannel(channel);
            Validator.ValidateSong(player.CurrentSong);
            var songDetail = await discovery.GetSongDetail(player.CurrentSong.Sid);
            Assert.IsNotNull(songDetail);
            Assert.IsNotEmpty(songDetail.ArtistChannels);
            foreach (var artistChannel in songDetail.ArtistChannels)
            {
                Validator.ValidateChannel(artistChannel);
            }

            Assert.IsNotNull(songDetail.SimilarSongChannel);
        }
 protected abstract EndpointAddress GetEndpoint(Discovery.Service service);
Exemple #52
0
        static int Main(string[] args)
        {
            var nodeIndex = CommandLine.GetInt32("multinode.index");
            var assemblyFileName = CommandLine.GetProperty("multinode.test-assembly");
            var typeName = CommandLine.GetProperty("multinode.test-class");
            var testName = CommandLine.GetProperty("multinode.test-method");
            var displayName = testName;

            var listenAddress = IPAddress.Parse(CommandLine.GetProperty("multinode.listen-address"));
            var listenPort = CommandLine.GetInt32("multinode.listen-port");
            var listenEndpoint = new IPEndPoint(listenAddress, listenPort);

            var system = ActorSystem.Create("NoteTestRunner-" + nodeIndex);
            var tcpClient = _logger = system.ActorOf<RunnerTcpClient>();
            system.Tcp().Tell(new Tcp.Connect(listenEndpoint), tcpClient);

            Thread.Sleep(TimeSpan.FromSeconds(10));
            using (var controller = new XunitFrontController(AppDomainSupport.IfAvailable, assemblyFileName))
            {
                /* need to pass in just the assembly name to Discovery, not the full path
                 * i.e. "Akka.Cluster.Tests.MultiNode.dll"
                 * not "bin/Release/Akka.Cluster.Tests.MultiNode.dll" - this will cause
                 * the Discovery class to actually not find any indivudal specs to run
                 */
                var assemblyName = Path.GetFileName(assemblyFileName);
                Console.WriteLine("Running specs for {0} [{1}]", assemblyName, assemblyFileName);
                using (var discovery = new Discovery(assemblyName, typeName))
                {
                    using (var sink = new Sink(nodeIndex, tcpClient))
                    {
                        try
                        {
                            controller.Find(true, discovery, TestFrameworkOptions.ForDiscovery());
                            discovery.Finished.WaitOne();
                            controller.RunTests(discovery.TestCases, sink, TestFrameworkOptions.ForExecution());
                        }
                        catch (AggregateException ex)
                        {
                            var specFail = new SpecFail(nodeIndex, displayName);
                            specFail.FailureExceptionTypes.Add(ex.GetType().ToString());
                            specFail.FailureMessages.Add(ex.Message);
                            specFail.FailureStackTraces.Add(ex.StackTrace);
                            foreach (var innerEx in ex.Flatten().InnerExceptions)
                            {
                                specFail.FailureExceptionTypes.Add(innerEx.GetType().ToString());
                                specFail.FailureMessages.Add(innerEx.Message);
                                specFail.FailureStackTraces.Add(innerEx.StackTrace);
                            }
                            _logger.Tell(specFail.ToString());
                            Console.WriteLine(specFail);

                            //make sure message is send over the wire
                            FlushLogMessages();
                            Environment.Exit(1); //signal failure
                            return 1;
                        }
                        catch (Exception ex)
                        {
                            var specFail = new SpecFail(nodeIndex, displayName);
                            specFail.FailureExceptionTypes.Add(ex.GetType().ToString());
                            specFail.FailureMessages.Add(ex.Message);
                            specFail.FailureStackTraces.Add(ex.StackTrace);
                            _logger.Tell(specFail.ToString());
                            Console.WriteLine(specFail);

                            //make sure message is send over the wire
                            FlushLogMessages();
                            Environment.Exit(1); //signal failure
                            return 1;
                        }

                        var timedOut = false;
                        if (!sink.Finished.WaitOne(MaxProcessWaitTimeout)) //timed out
                        {
                            var line = string.Format("Timed out while waiting for test to complete after {0} ms",
                                MaxProcessWaitTimeout);
                            _logger.Tell(line);
                            Console.WriteLine(line);
                            timedOut = true;
                        }

                        FlushLogMessages();
                        system.Terminate().Wait();

                        Environment.Exit(sink.Passed && !timedOut ? 0 : 1);
                        return sink.Passed ? 0 : 1;
                    }
                }
            }
        }
Exemple #53
0
 private void _Client_ByeReceived(object sender, Discovery.SSDP.Events.ByeReceivedEventArgs e)
 {
     if (InvokeRequired)
         Invoke((MethodInvoker)delegate
         {
             _Client_ByeReceived(sender, e);
         });
     else
         txtResults.Text = "bye: " + e.Service.ServiceType + "\r\n" + txtResults.Text;
 }
 public GetCapabilitiesProcessorAccessor(Discovery service) :
     base(service)
 {}
        /// <summary>
        /// Stops the UPnP discovery.
        /// </summary>
        protected void Stop()
        {
            // If the discovery is available
            if (mdDiscovery != null)
            {
                // Stop it if its searching
                if (mdDiscovery.Searching) mdDiscovery.Stop();

                // Remove events
                mdDiscovery.DeviceAdded -= new DeviceAddedEventHandler(mdDiscovery_DeviceAdded);
                mdDiscovery.DeviceRemoved -= new DeviceRemovedEventHandler(mdDiscovery_DeviceRemoved);
                mdDiscovery.SearchComplete -= new SearchCompleteEventHandler(mdDiscovery_SearchComplete);

                // Dispose of the discover and clear it
                mdDiscovery.Dispose();
                mdDiscovery = null;

                // Raise the SearchEnded event
                OnSearchEnded(new EventArgs());
            }
        }
        /// <summary>
        /// Starts the UPnP discovery.
        /// </summary>
        protected void Start()
        {
            if (!IsRunning())
            {
                // Create the discovery
                mdDiscovery = new Discovery(msSearchUri, maffAddressFamilyFlags, mbResolveNetworkInterface);

                // Add events
                mdDiscovery.DeviceAdded += new DeviceAddedEventHandler(mdDiscovery_DeviceAdded);
                mdDiscovery.DeviceRemoved += new DeviceRemovedEventHandler(mdDiscovery_DeviceRemoved);
                mdDiscovery.SearchComplete += new SearchCompleteEventHandler(mdDiscovery_SearchComplete);

                // Raise search started event
                OnSearchStarted(new EventArgs());

                // If the discover didnt start
                if (!mdDiscovery.Start())
                {
                    // Raise the search failed event
                    OnSearchFailed(new EventArgs());

                    // Stop and raise the search stopped event
                    Stop();
                }
            }
        }
 private static IEnumerable<IRuleInfo> GetPhoenixFxCopRules(string assemblyName)
 {
     var discovery = new Discovery();
     discovery.LoadAssemblyFrom(assemblyName);
     return discovery.GetExtensions<RuleInfo>();
 }
 public GetRecordsProcessorAccessor(Discovery service):
     base(service)
 {}
Exemple #59
0
 private void _Client_DiscoveryReceived(object sender, Discovery.SSDP.Events.DiscoveryReceivedEventArgs e)
 {
     if (InvokeRequired)
         Invoke((MethodInvoker)delegate { _Client_DiscoveryReceived(sender, e); });
     else
         txtResults.Text = string.Format("discovered: {0} - {1}\r\n{2}", e.Service.ServiceType, e.Service.Location, txtResults.Text);
 }
 protected override void StartDiscoverer(Discovery.ServiceDiscoverer discoverer, Guid guid)
 {
     discoverer.Start(null, 0, guid);
 }