public void TestGetAvailableBySpot() { Accommodation testAccommodation = new Accommodation() { Id = 1, Address = "Test1", Bookings = null, ContactNumber = "0993456611", Full = false, Name = "Hilton", Information = "Epic", PricePerNight = 120.76, Spot = new TouristicSpot() { Name = "a" }, SpotId = 2 }; List <Accommodation> accommodationList = new List <Accommodation>() { new Accommodation() { Id = 2, Address = "Test", Bookings = null, ContactNumber = "09934566", Full = false, Name = "Radisson", Information = "nice", PricePerNight = 1.76, Spot = new TouristicSpot() { Name = "h" }, SpotId = 1 }, testAccommodation, }; accommodationList.ForEach(s => _context.Add(s)); _context.SaveChanges(); var repository = new AccommodationRepository(_context); var result = repository.GetAvailableBySpot(2); Assert.IsTrue(testAccommodation.Equals(result.FirstOrDefault())); }
public void TestEqualsExpectedTrue() { this.accommodation.Id = 1; this.accommodation.Name = "test"; Accommodation test = new Accommodation { Id = 1, Name = "test" }; Assert.IsTrue(accommodation.Equals(test)); }