-
Notifications
You must be signed in to change notification settings - Fork 139
Expand file tree
/
Copy pathBookingShould.cs
More file actions
87 lines (74 loc) · 3.21 KB
/
BookingShould.cs
File metadata and controls
87 lines (74 loc) · 3.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
using System;
using Xunit;
namespace CodelyTv.Booking.Tests
{
public sealed class BookingShould
{
[Fact]
private void GetTheCorrectStatusWhenTheBookingHasNotStartedYet()
{
var dateBeforeBookingHasStarted = new DateTime(2020, 5, 1, 12, 0, 0);
var bookingStartDate = new DateTime(2020, 6, 26, 19, 0, 0);
var bookingEndDate = new DateTime(2020, 7, 14, 16, 0, 0);
private Booking CreateBooking(DateTime startDate, DateTime endDate)
{
return new Booking(
new BookingId("2c1e34d0-1430-4307-80bf-a71761f71390"),
startDate,
endDate,
new CustomerId("72cf3524-7838-45f3-8179-2e75abe5e81c"),
new CustomerName("Perico Los Palotes"),
new EmailAddress("perico.los.palotes@mail.com"),
BookingType.VACATION,
DiscountType.NONE,
new DiscountValue(0),
TaxType.NONE,
new TaxValue(0)
);
}
Assert.Equal(BookingStatus.NOT_STARTED, booking.StatusFor(dateBeforeBookingHasStarted));
}
[Fact]
private void GetTheCorrectStatusWhenTheBookingIsCurrentlyActive()
{
var dateBetweenBooking = new DateTime(2020, 6, 29, 15, 0, 0);
var bookingStartDate = new DateTime(2020, 6, 26, 19, 0, 0);
var bookingEndDate = new DateTime(2020, 7, 14, 16, 0, 0);
var booking = new Booking(
new BookingId("2c1e34d0-1430-4307-80bf-a71761f71390"),
bookingStartDate,
bookingEndDate,
new CustomerId("72cf3524-7838-45f3-8179-2e75abe5e81c"),
new CustomerName("Perico Los Palotes"),
new EmailAddress("perico.los.palotes@mail.com"),
BookingType.VACATION,
DiscountType.NONE,
new DiscountValue(0),
TaxType.NONE,
new TaxValue(0)
);
Assert.Equal(BookingStatus.ACTIVE, booking.StatusFor(dateBetweenBooking));
}
[Fact]
private void GetTheCorrectStatusWhenTheBookingIsFinished()
{
var dateAfterBookingEnds = new DateTime(2020, 8, 30, 19, 0, 0);
var bookingStartDate = new DateTime(2020, 6, 26, 19, 0, 0);
var bookingEndDate = new DateTime(2020, 7, 14, 16, 0, 0);
var booking = new Booking(
new BookingId("2c1e34d0-1430-4307-80bf-a71761f71390"),
bookingStartDate,
bookingEndDate,
new CustomerId("72cf3524-7838-45f3-8179-2e75abe5e81c"),
new CustomerName("Perico Los Palotes"),
new EmailAddress("perico.los.palotes@mail.com"),
BookingType.VACATION,
DiscountType.NONE,
new DiscountValue(0),
TaxType.NONE,
new TaxValue(0)
);
Assert.Equal(BookingStatus.FINISHED, booking.StatusFor(dateAfterBookingEnds));
}
}
}