public void ClientOnlineTest_Online_CameInTeFuture()
        {
            var clientOnline = new ClientOnline(new MockedCurrentTime(new DateTime(2020, 5, 23, 2, 25, 0)));
            var result       = clientOnline.IsClientOnline(new DateTime(2020, 5, 23, 2, 26, 0));

            Assert.AreEqual(result, true);
        }
        public void ClientOnlineTest_Offline_LateReceive()
        {
            var clientOnline = new ClientOnline(new MockedCurrentTime(new DateTime(2020, 5, 23, 2, 25, 0)));
            var result       = clientOnline.IsClientOnline(new DateTime(2020, 5, 23, 2, 23, 0));

            Assert.AreEqual(result, false);
        }
Beispiel #3
0
        public IEnumerable <ClientStatus> Get()
        {
            var ipClientHashStr = _distributedCache.GetString(CACHE_KEY);

            if (string.IsNullOrEmpty(ipClientHashStr) == true)
            {
                return(new ClientStatus[0]);
            }
            else
            {
                var ipClientHash = JsonConvert.DeserializeObject <Dictionary <string, ClientTypeSaved> >(ipClientHashStr);
                return(ipClientHash.Values.Select(ClientReceived => new ClientStatus(ClientReceived.Client, _clientOnline.IsClientOnline(ClientReceived.ReceivedDate))));
            }
        }