Ejemplo n.º 1
0
        public void GetLatestSiteStateTest()
        {
            SiteService target = new SiteService(new RepositoryMock<Site>(), new RepositoryMock<Measurement>());
            Site site = new Site()
            {
                Description = "Description",
                Latitude = 43.012312,
                Longitude = 12.12312,
                Serialnumber = "!§$%&/()",
                SiteID = 1
            };
            Measurement expected = new Measurement()
            {
                MeasurementID = 1,
                Time = DateTime.Now,
                Value = 100
            };
            site.Measurements.Add(expected);
            site.Measurements.Add(new Measurement()
            {
                MeasurementID = 2,
                Time = DateTime.Now.Subtract(TimeSpan.FromDays(1000)),
                Value = 100
            });

            site.Measurements.Add(new Measurement()
            {
                MeasurementID = 3,
                Time = DateTime.Now.Subtract(TimeSpan.FromHours(1)),
                Value = 100
            });

            site.Measurements.Add(new Measurement()
            {
                MeasurementID = 4,
                Time = DateTime.Now.Subtract(TimeSpan.FromSeconds(1)),
                Value = 100
            });

            Measurement actual;
            actual = target.GetLatestSiteState(site);
            Assert.AreEqual(expected, actual);
        }
Ejemplo n.º 2
0
        public void GetSitesTest()
        {
            SiteService target = new SiteService(new RepositoryMock<Site>(), new RepositoryMock<Measurement>());
            Customer customer = new Customer()
            {
                Person = new Person()
                {
                    Email = "*****@*****.**",
                    Firstname = "PersonVorname",
                    Lastname = "PersonNachname",
                    Password = "******",
                    Username = "******"
                }
            };

            customer.Sites.Add(new Site()
            {
                Description = "Description",
                Latitude = 43.012312,
                Longitude = 12.12312,
                Serialnumber = "!§$%&/()",
                SiteID = 1
            });

            customer.Sites.Add(new Site()
            {
                Description = "Description",
                Latitude = 43.012312,
                Longitude = 12.12312,
                Serialnumber = "!§$%&/()",
                SiteID = 2
            });

            List<Site> expected = new List<Site>(customer.Sites);
            List<Site> actual;
            actual = target.GetSites(customer);
            Assert.AreEqual(expected[0], actual[0]);
            Assert.AreEqual(expected[1], actual[1]);
        }
Ejemplo n.º 3
0
 public void GetLatestSiteExceptionStateTest()
 {
     SiteService siteservice = new SiteService(new RepositoryMock<Site>(), new RepositoryMock<Measurement>());
     siteservice.GetLatestSiteState(null);
 }
Ejemplo n.º 4
0
 public void GetLatestSiteExceptionStateTest()
 {
     SiteService siteservice = new SiteService();
     siteservice.GetLatestSiteState(null);
 }