Awesome.
So now that we have that remembers booking finished, let's go ahead and refactor it because we can
improve something here.
Switch over to the flight class, take a look at that bookings list so it is public, which means that
actually everyone who has access to our code or writes some sort of injection can actually add something
to the booking list and we don't want to have that.
So what we do is we make that a little bit more mutable or privately mutable so that we can only add
something from inside of this class.
And we do that in a very easy way.
So we will just get rid of that here in a second.
Let's just write the new one.
Let's create the private list of booking, right?
So if we don't have an access modifier, it's private like this.
So booking list is equal to new.
We don't have to specify the type because that's one of the new features of C-sharp, right?
We can just say new and it will automatically check the type.
And yeah, now we have a new booking list.
But for sure we want to make this accessible from the outside so that people can read.
So we simply create a public enumerable of type booking.
And there we go of type booking, let's call it.
Yeah, booking list.
We just had that booking list.
There we go.
And that goes to the booking list.
And that one does not have an Add method, so people can only read from booking list here.
And that's awesome because it's of type enumerable, right?
Not a list.
And yeah, in that way you can now see that when we scroll down we have that booking list Add, which
is not working because this is the public one.
What we need to use the private one booking list, which is actually a proof of what I've just talked
about.
So we can only use or can only add new bookings to that booking list from inside of the flight class.
Great.
And that's all what we have to take care of now regarding refactoring.
And now we are done with chapter three.
And in this chapter you have learned how to improve your test trustworthiness by using the Devil's advocate
technique and parameterizing the tests.
We also discovered some new scenarios and in the next chapter we will discover even more scenarios and
also learn the test driven development loss.
So again, a very important and exciting topic.
So definitely stay tuned and I'll see you in the next chapter just in a second.