Skip to content

Commit b2a0df7

Browse files
feat(client): use strings for date/time
1 parent f916e97 commit b2a0df7

20 files changed

+309
-1995
lines changed

src/Orb.Tests/Models/CreditNotes/CreditNoteCreateParamsTest.cs

Lines changed: 12 additions & 109 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
using System;
21
using System.Text.Json;
32
using Orb.Core;
43
using Orb.Exceptions;
@@ -15,50 +14,14 @@ public void FieldRoundtrip_Works()
1514
{
1615
Amount = "amount",
1716
InvoiceLineItemID = "4khy3nwzktxv7",
18-
EndDate =
19-
#if NET
20-
DateOnly
21-
#else
22-
DateTimeOffset
23-
#endif
24-
.Parse("2023-09-22"),
25-
StartDate =
26-
#if NET
27-
DateOnly
28-
#else
29-
DateTimeOffset
30-
#endif
31-
.Parse("2023-09-22"),
17+
EndDate = "2023-09-22",
18+
StartDate = "2023-09-22",
3219
};
3320

3421
string expectedAmount = "amount";
3522
string expectedInvoiceLineItemID = "4khy3nwzktxv7";
36-
37-
#if NET
38-
DateOnly
39-
#else
40-
DateTimeOffset
41-
#endif
42-
expectedEndDate =
43-
#if NET
44-
DateOnly
45-
#else
46-
DateTimeOffset
47-
#endif
48-
.Parse("2023-09-22");
49-
50-
#if NET
51-
DateOnly
52-
#else
53-
DateTimeOffset
54-
#endif
55-
expectedStartDate =
56-
#if NET
57-
DateOnly
58-
#else
59-
DateTimeOffset
60-
#endif
61-
.Parse("2023-09-22");
23+
string expectedEndDate = "2023-09-22";
24+
string expectedStartDate = "2023-09-22";
6225

6326
Assert.Equal(expectedAmount, model.Amount);
6427
Assert.Equal(expectedInvoiceLineItemID, model.InvoiceLineItemID);
@@ -73,20 +36,8 @@ public void SerializationRoundtrip_Works()
7336
{
7437
Amount = "amount",
7538
InvoiceLineItemID = "4khy3nwzktxv7",
76-
EndDate =
77-
#if NET
78-
DateOnly
79-
#else
80-
DateTimeOffset
81-
#endif
82-
.Parse("2023-09-22"),
83-
StartDate =
84-
#if NET
85-
DateOnly
86-
#else
87-
DateTimeOffset
88-
#endif
89-
.Parse("2023-09-22"),
39+
EndDate = "2023-09-22",
40+
StartDate = "2023-09-22",
9041
};
9142

9243
string json = JsonSerializer.Serialize(model);
@@ -102,20 +53,8 @@ public void FieldRoundtripThroughSerialization_Works()
10253
{
10354
Amount = "amount",
10455
InvoiceLineItemID = "4khy3nwzktxv7",
105-
EndDate =
106-
#if NET
107-
DateOnly
108-
#else
109-
DateTimeOffset
110-
#endif
111-
.Parse("2023-09-22"),
112-
StartDate =
113-
#if NET
114-
DateOnly
115-
#else
116-
DateTimeOffset
117-
#endif
118-
.Parse("2023-09-22"),
56+
EndDate = "2023-09-22",
57+
StartDate = "2023-09-22",
11958
};
12059

12160
string element = JsonSerializer.Serialize(model);
@@ -124,32 +63,8 @@ public void FieldRoundtripThroughSerialization_Works()
12463

12564
string expectedAmount = "amount";
12665
string expectedInvoiceLineItemID = "4khy3nwzktxv7";
127-
128-
#if NET
129-
DateOnly
130-
#else
131-
DateTimeOffset
132-
#endif
133-
expectedEndDate =
134-
#if NET
135-
DateOnly
136-
#else
137-
DateTimeOffset
138-
#endif
139-
.Parse("2023-09-22");
140-
141-
#if NET
142-
DateOnly
143-
#else
144-
DateTimeOffset
145-
#endif
146-
expectedStartDate =
147-
#if NET
148-
DateOnly
149-
#else
150-
DateTimeOffset
151-
#endif
152-
.Parse("2023-09-22");
66+
string expectedEndDate = "2023-09-22";
67+
string expectedStartDate = "2023-09-22";
15368

15469
Assert.Equal(expectedAmount, deserialized.Amount);
15570
Assert.Equal(expectedInvoiceLineItemID, deserialized.InvoiceLineItemID);
@@ -164,20 +79,8 @@ public void Validation_Works()
16479
{
16580
Amount = "amount",
16681
InvoiceLineItemID = "4khy3nwzktxv7",
167-
EndDate =
168-
#if NET
169-
DateOnly
170-
#else
171-
DateTimeOffset
172-
#endif
173-
.Parse("2023-09-22"),
174-
StartDate =
175-
#if NET
176-
DateOnly
177-
#else
178-
DateTimeOffset
179-
#endif
180-
.Parse("2023-09-22"),
82+
EndDate = "2023-09-22",
83+
StartDate = "2023-09-22",
18184
};
18285

18386
model.Validate();

0 commit comments

Comments
 (0)