public async Task GivenValidCandidate_WhenCreatingBooking_ShouldGetDetailsFromCandidate()
        {
            var candidateRepository = BookingCandidateRepositoryTest.CreateBookingCandidateRepositoryForTest();
            var newCandidate        = BookingCandidateRepositoryTest.GetBookingCandidateForTest();

            const int placeInQueue = 1;
            var       candidateId  = await candidateRepository.CreateAsync(newCandidate);

            var repository = GetBookingRepositoryForTest();
            var evnt       = await EventRepositoryTest.GetEventForTestAsync();

            var candidate = await candidateRepository.FindByIdAsync(candidateId);

            var result = await repository.CreateFromCandidateAsync(evnt, candidate, placeInQueue);

            var booking = await repository.FindByReferenceAsync(result.Reference);

            Assert.IsNotNull(booking);
            Assert.AreEqual(booking.EventId, evnt.Id);
            Assert.IsTrue(booking.CandidateId.HasValue);
            Assert.AreEqual(booking.CandidateId.Value, candidateId);
            Assert.AreEqual(booking.FirstName, newCandidate.FirstName);
            Assert.AreEqual(booking.LastName, newCandidate.LastName);
            Assert.AreEqual(booking.Email, newCandidate.Email);
            Assert.AreEqual(booking.PhoneNo, newCandidate.PhoneNo);
            Assert.AreEqual(booking.TeamName, newCandidate.TeamName);
            Assert.AreEqual(placeInQueue, booking.QueueNo);
            Assert.AreEqual(String.Empty, booking.SpecialRequest);
            Assert.AreEqual(0.0m, booking.TotalPrice);
        }
        internal static async Task <Booking> GetNewlyCreatedBookingForTest(Event evnt, BookingRepository repository)
        {
            var candidate = BookingCandidateRepositoryTest.GetBookingCandidateForTest();
            var result    = await repository.CreateFromCandidateAsync(evnt, candidate, 1);

            return(await repository.FindByReferenceAsync(result.Reference));
        }
        public async Task GivenBookingCreatedFromCandidate_WhenCandidateDeleted_ShouldRetainBooking()
        {
            var candidate = await BookingCandidateRepositoryTest.GetNewlyCreatedBookingCandidateForTest();

            var repository = GetBookingRepositoryForTest();
            var evnt       = await EventRepositoryTest.GetEventForTestAsync();

            var result = await repository.CreateFromCandidateAsync(evnt, candidate, 1);

            var candidateRepository = BookingCandidateRepositoryTest.CreateBookingCandidateRepositoryForTest();
            await candidateRepository.DeleteAllAsync();

            candidate = await candidateRepository.FindByIdAsync(candidate.Id);

            Assert.IsNull(candidate);

            var booking = await repository.FindByReferenceAsync(result.Reference);

            Assert.IsNotNull(booking);
            Assert.AreEqual(booking.EventId, evnt.Id);
            Assert.IsFalse(booking.CandidateId.HasValue);
        }