public void Handle_ReserveBookCommand_Member_Not_Exists() { // arrange var key = MockBuilder.Key; var copy = CopyMock.Get(key); MockRepository.Add(copy); MockRepository.Commit(); var command = ReserveBookCommandMock.Get(key); // act var result = Handle(command); // assert result.Should().BeTrue(); var members = MockRepository.Query <Member>().ToList(); var memberExpected = MemberMock.Get(key); members.Should().BeEquivalentToEntity(MockBuilder.List(memberExpected)); var reservations = MockRepository.Query <Reservation>() .Include(x => x.Loans) .ThenInclude(x => x.Copy) .ThenInclude(x => x.Book) .Include(x => x.Member) .ToList(); var reservationExpected = ReservationMock.Get(key); reservationExpected.Member = memberExpected; reservations.Should().BeEquivalentToEntity(MockBuilder.List(reservationExpected)); }
public void GetByFilterAsync_Reservation_Filter_Number() { var keys = new string[] { FakeHelper.Key, FakeHelper.Key }; MockRepository.Add(ReservationMock.Get(keys[0])); MockRepository.Add(ReservationMock.Get(keys[1])); var pagination = PagedRequestMock.Create(ReservationFilterPayloadMock.Get(keys[0])); pagination.Filter.Number = Fake.GetReservationNumber(keys[0]); var proxy = GetByFilterAsync(pagination); proxy.Should().NotBeNull(); var proxy1 = ReservationProxyMock.Get(keys[0]); proxy1.MemberId = MemberMock.Get(keys[0]).UserId; var pagedProxyExpected = PagedResponseMock.Create(proxy1); proxy.Should().BeEquivalentToModel(pagedProxyExpected); }
public ReservationFilterPayloadMock Default() { Value.MemberId = MemberMock.Get(Key).UserId; Value.MemberName = Fake.GetMemberName(Key); Value.Items.Add(GetItem(Key)); return(this); }