Skip to content

Commit

Permalink
test: call hotel repository when finding hotel by hotelId
Browse files Browse the repository at this point in the history
  • Loading branch information
D-Arturo committed Aug 10, 2024
1 parent 754ca77 commit b582e06
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,17 @@ public void CallHotelRepositoryWhenAddingNewHotel()
hotelService.AddHotel(hotelId, newHotelName);
hotelRepository.Verify(repository => repository.AddHotel(newHotel), Times.Once);
}

[Fact]
public void CallHotelRepositoryWhenFindingHotelById()
{
var hotelRepository = new Mock<IHotelRepository>();
var hotelService = new HotelService(hotelRepository.Object);
var newHotelId = "3598ca62-4516-4a75-9eb3-64a6f1c59381";
var hotelId = new HotelId(newHotelId);

hotelService.FindHotelBy(hotelId);

hotelRepository.Verify(repository => repository.FindHotelBy(hotelId));
}
}
1 change: 1 addition & 0 deletions CorporateHotel/HotelManagement/Domain/IHotelRepository.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@
public interface IHotelRepository
{
void AddHotel(Hotel newHotel);
Hotel FindHotelBy(HotelId hotelId);
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,9 @@ public void AddHotel(Hotel newHotel)
{
_hotels.Add(newHotel);
}

public Hotel FindHotelBy(HotelId hotelId)
{
throw new NotImplementedException();
}
}

0 comments on commit b582e06

Please sign in to comment.