public void GetLatestSiteExceptionStateTest() { SiteService siteservice = new SiteService(new RepositoryMock<Site>(), new RepositoryMock<Measurement>()); siteservice.GetLatestSiteState(null); }
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); }
public void GetLatestSiteExceptionStateTest() { SiteService siteservice = new SiteService(); siteservice.GetLatestSiteState(null); }