public LocationServiceTests()
 {
     GoodLocations = new List<LocationRecord>(Fixture.CreateMany<LocationRecord>());
     GoodLocation = GoodLocations.First();
     BadLandmark = Fixture.Create<Landmark>();
     GoodCallsign = Fixture.Create<IMEIToCallsign>();
     UnknownIMEI = Fixture.Create<string>();
     GoodLandmarks = new List<Landmark>(Fixture.CreateMany<Landmark>());
     GoodLandmark = GoodLandmarks.First();
 }
        private async Task ClearLandmark(int id, Landmark linkedObject = null)
        {
            var landmarks = CreateMockLandmarkDbSet();
            var context = CreateMockLocationContext(landmarks: landmarks.Object);

            var service = new LocationService(context.Object);

            await service.ClearLandmark(id);

            if (linkedObject != null)
            {
                Assert.True((linkedObject.Expiry - DateTimeOffset.Now).TotalSeconds < -DateTimeTolerance);
                context.Verify(c => c.SaveChangesAsync());
            }
            else
            {
                context.Verify(c => c.SaveChangesAsync(), Times.Never);
            }
        }
        private static bool ValidateLandmarkRecord(Landmark landmark, string name, decimal latitude, decimal longitude, DateTimeOffset? expiry)
        {
            if (expiry == null)
                expiry = DateTimeOffset.Now.AddDays(7);

            Assert.Equal(latitude, landmark.Latitude);
            Assert.Equal(longitude, landmark.Longitude);
            Assert.Equal(name, landmark.Name);
            Assert.True(Math.Abs((expiry.Value - landmark.Expiry).TotalSeconds) < DateTimeTolerance);
            return true;
        }