Exemplo n.º 1
0
 public void EqualsBusinessTest2()
 {
     double weigth = 0F; // TODO: Initialize to an appropriate value
     WiFiSensor assumption = new WiFiSensor(getNetworks(0, 50, 5), weigth, null); // TODO: Initialize to an appropriate value
     WiFiSensor target = new WiFiSensor(getNetworks(2, 50, 5), weigth, null);
     Assert.IsFalse(assumption.EqualsBusiness(target));
 }
Exemplo n.º 2
0
 public void EqualsBusinessTest()
 {
     var networks = getNetworks(0, 50, 5); // TODO: Initialize to an appropriate value
     double weigth = 0F; // TODO: Initialize to an appropriate value
     WiFiSensor assumption = new WiFiSensor(networks, weigth,null); // TODO: Initialize to an appropriate value
     WiFiSensor target = new WiFiSensor(networks, weigth, null);
     Assert.IsTrue(assumption.EqualsBusiness(target));
 }
Exemplo n.º 3
0
 public void GetDistanceTest1()
 {
     var networks = getNetworks(0, 50, 5);
     double weigth = 4F;
     WiFiSensor target = new WiFiSensor(networks, weigth, null);
     WiFiSensor target2 = new WiFiSensor(networks, weigth, null);
     double actual = target.GetDistance(target2);
     double aspected = 1F;
     Assert.AreEqual(aspected, actual);
 }
Exemplo n.º 4
0
        public IList<WiFiSensor> GetAllWiFiSensorData()
        {
            IList<WiFiSensor> sensors = new List<WiFiSensor>();
            try
            {
                using (var wifiApi = new JimbeWiFi(_version))
                {
                    logger.Debug("Getting wlan interfaces list");
                    var interfaceslist = wifiApi.WiFiEnumInterfaces();
                    foreach (WifiInterface wifiInterface in interfaceslist)
                    {
                        var wiFiSensor = new WiFiSensor()
                            {
                                Weigth = NotConnectedWeigth,
                                HistorySize = 10
                            };
                        logger.Debug("Getting wlan networks list from interface ", wifiInterface.InterfaceGuid, " ", wifiInterface.Description);
                        try
                        {
                            var networkslist = wifiApi.WiFiGetAvailableNetworkList(wifiInterface);
                            var wiFiNetworkSet = new WiFiNetworkSet()
                                {
                                    Sensor = wiFiSensor
                                };

                            IList<WiFiNetwork> networks =
                                (from net in networkslist select new WiFiNetwork(net.Ssid, net.SignalQuality,wiFiNetworkSet)).ToList();

                            wiFiNetworkSet.Networks=networks;
                            wiFiSensor.Datasets.Add(wiFiNetworkSet);
                            sensors.Add(wiFiSensor);

                        } catch (WifiException we)
                        {
                            logger.Error("Error in getting networks from wlan Interface: ", wifiInterface.InterfaceGuid," ", wifiInterface.Description," ", we.Message);
                        }
                    }
                }
            }catch( WifiToManyHandleException we)
            {
                logger.Error(we.Message);
            } catch(WifiException we)
            {
                logger.Error(we.Message);
            }
            return sensors;
        }
Exemplo n.º 5
0
 public void WiFiSensorConstructorTest()
 {
     var networks = getNetworks(0, 50, 5); // TODO: Initialize to an appropriate value
     double weigth = 1F; // TODO: Initialize to an appropriate value
     WiFiSensor target = new WiFiSensor(networks, weigth, null);
     Assert.IsNotNull(target);
 }
Exemplo n.º 6
0
 public void WeigthTest()
 {
     double weigth = 5F;
     WiFiSensor target = new WiFiSensor(null, weigth, null);
     double actual;
     actual = target.Weigth;
     Assert.AreEqual(weigth, actual);
 }
Exemplo n.º 7
0
 public void UpdateSensorDatasetTest()
 {
     var networks = getNetworks(0, 60, 10);
     double weigth = 4F;
     int aspected = networks.Count;
     WiFiSensor target = new WiFiSensor(networks, weigth, null);
     var networks2 = getNetworks(5, 80, 10);
     WiFiSensor second = new WiFiSensor(networks2, weigth, null);
     target.UpdateSensorDataset(second);
     int targetcount = target.Datasets.Count;
     aspected += networks2.Count;
     Assert.AreEqual(aspected, targetcount);
 }