Ejemplo n.º 1
0
 public static void StartSession(string server, int port, string userName)
 {
     _remoteLog = new RemoteErrorCollect(
         server,
         port,
         SystemInfo.deviceUniqueIdentifier,
         Application.platform.ToString(),
         userName
         );
     _remoteLog.StartSession(() => {});
     Application.logMessageReceived += LogErrorToServer;
 }
Ejemplo n.º 2
0
        static void Main(string[] args)
        {
            Console.Write("Connecting....");
            var client = new RemoteErrorCollect(
                "localhost",
                2358,
                "consoleclient",
                "WindowsConsole",
                "Console User");

            Console.Write("Connected!\nRecieving:\n");

            while (true)
            {
                Console.WriteLine("Press any key to send error to server.");
                Console.ReadKey();
                var exception = new Exception("Logged from the console client");
                client.LogError(exception);
                Console.WriteLine("Exception sent to server.");
            }
        }
Ejemplo n.º 3
0
        public void StartSession()
        {
            // Arrange
            var db         = new ErrorCollectModelContainer();
            var guid       = "submittedfromunitestlogerror-startsession";
            var username   = "******";
            var platform   = "Test StartSession";
            var mockClient = new RemoteErrorCollect(
                "localhost",
                2358,
                guid,
                platform,
                username
                );
            bool sessionStarted = false;
            int  timeout        = 0;

            using (var host = new ServiceHost(typeof(ErrorCollectService.ErrorCollectService))) {
                host.Open();

                // Act
                mockClient.StartSession(() => { sessionStarted = true; });
                while (!sessionStarted && timeout++ < 10000)
                {
                    System.Threading.Thread.Sleep(10);
                }

                // Assert
                Assert.IsTrue(sessionStarted);
                Assert.IsNotNull(mockClient.SessionId);
                var session = db.Sessions.Find(mockClient.SessionId);
                Assert.IsNotNull(session);
                Assert.AreEqual(guid, session.Device.DeviceGUID);
                Assert.AreEqual(username, session.User.Name);
                Assert.AreEqual(platform, session.Platform.Name);

                db.Entry(session).State = System.Data.Entity.EntityState.Deleted;
                db.SaveChanges();
            }
        }