CSLA.NET 6.0.0
CSLA .NET is a software development framework that helps you build a reusable, maintainable object-oriented business layer for your app.
SmartDateTests.cs
Go to the documentation of this file.
1//-----------------------------------------------------------------------
2// <copyright file="SmartDateTests.cs" company="Marimer LLC">
3// Copyright (c) Marimer LLC. All rights reserved.
4// Website: https://cslanet.com
5// </copyright>
6// <summary>no summary</summary>
7//-----------------------------------------------------------------------
8using Csla;
10using System;
11using UnitDriven;
12#if !WINDOWS_PHONE
13using Microsoft.VisualBasic;
14#endif
16using System.Threading;
17
18#if NUNIT
19using NUnit.Framework;
20using TestClass = NUnit.Framework.TestFixtureAttribute;
21using TestInitialize = NUnit.Framework.SetUpAttribute;
22using TestCleanup = NUnit.Framework.TearDownAttribute;
23using TestMethod = NUnit.Framework.TestAttribute;
24using TestSetup = NUnit.Framework.SetUpAttribute;
25using Microsoft.VisualBasic;
27#elif MSTEST
28using Microsoft.VisualStudio.TestTools.UnitTesting;
29using System.IO;
30using Csla.TestHelpers;
31#endif
32
34{
35 [TestClass()]
36 public class SmartDateTests
37 {
38 private static TestDIContext _testDIContext;
39 System.Globalization.CultureInfo CurrentCulture { get; set; }
40 System.Globalization.CultureInfo CurrentUICulture { get; set; }
41
43 public static void ClassInitialize(TestContext context)
44 {
45 _testDIContext = TestDIContextFactory.CreateDefaultContext();
46 }
47
48 [TestInitialize]
49 public void Setup()
50 {
51
52 // store current cultures
53 CurrentCulture = System.Threading.Thread.CurrentThread.CurrentCulture;
54 CurrentUICulture = System.Threading.Thread.CurrentThread.CurrentUICulture;
55
56 // set to "en-US" for all tests
57 System.Threading.Thread.CurrentThread.CurrentCulture = System.Globalization.CultureInfo.GetCultureInfo("en-US");
58 System.Threading.Thread.CurrentThread.CurrentUICulture = System.Globalization.CultureInfo.GetCultureInfo("en-US");
59 }
60
61 [TestCleanup]
62 public void Cleanup()
63 {
64 // restore original cultures
65 System.Threading.Thread.CurrentThread.CurrentCulture = CurrentCulture;
66 System.Threading.Thread.CurrentThread.CurrentUICulture = CurrentUICulture;
67 }
68
69 #region Test Constructors
70 [TestMethod()]
72 {
73 DateTime now = DateTime.Now;
74 Csla.SmartDate d = new Csla.SmartDate(now);
75 Assert.AreEqual(now, d.Date);
76
77 d = new Csla.SmartDate(true);
78 Assert.IsTrue(d.EmptyIsMin);
79 d = new Csla.SmartDate(false);
80 Assert.IsFalse(d.EmptyIsMin);
81
82 d = new Csla.SmartDate("1/1/2005");
83 Assert.AreEqual("1/1/2005", d.ToString());
84 d = new Csla.SmartDate("Jan/1/2005");
85 Assert.AreEqual("1/1/2005", d.ToString());
86 d = new Csla.SmartDate("January-1-2005");
87 Assert.AreEqual("1/1/2005", d.ToString());
88 d = new Csla.SmartDate("1-1-2005");
89 Assert.AreEqual("1/1/2005", d.ToString());
90 d = new Csla.SmartDate("");
91 Assert.AreEqual("", d.ToString());
92 Assert.IsTrue(d.IsEmpty);
93
94 d = new Csla.SmartDate("1/1/2005", true);
95 Assert.AreEqual("1/1/2005", d.ToString());
96 Assert.IsTrue(d.EmptyIsMin);
97 d = new Csla.SmartDate("1/1/2005", false);
98 Assert.AreEqual("1/1/2005", d.ToString());
99 Assert.IsFalse(d.EmptyIsMin);
100 d = new Csla.SmartDate("", true);
101 Assert.AreEqual(DateTime.MinValue, d.Date);
102 Assert.AreEqual("", d.ToString());
103 d = new Csla.SmartDate("", false);
104 Assert.AreEqual(DateTime.MaxValue, d.Date);
105 Assert.AreEqual("", d.ToString());
106
107 try
108 {
109 d = new Csla.SmartDate("Invalid Date", true);
110 }
111 catch (Exception ex) { Assert.IsTrue(ex is ArgumentException); }
112 try
113 {
114 d = new Csla.SmartDate("Invalid Date", false);
115 }
116 catch (Exception ex) { Assert.IsTrue(ex is ArgumentException); }
117
118 d = new Csla.SmartDate(now, true);
119 Assert.AreEqual(now, d.Date);
120 Assert.IsTrue(d.EmptyIsMin);
121 d = new Csla.SmartDate(now, false);
122 Assert.AreEqual(now, d.Date);
123 Assert.IsFalse(d.EmptyIsMin);
124
125 d = new Csla.SmartDate((DateTime?)null, true);
126 Assert.AreEqual(DateTime.MinValue, d.Date);
127 d = new Csla.SmartDate((DateTime?)null, false);
128 Assert.AreEqual(DateTime.MaxValue, d.Date);
129 d = new Csla.SmartDate((DateTime?)null, Csla.SmartDate.EmptyValue.MinDate);
130 Assert.AreEqual(DateTime.MinValue, d.Date);
131 d = new Csla.SmartDate((DateTime?)null, Csla.SmartDate.EmptyValue.MaxDate);
132 Assert.AreEqual(DateTime.MaxValue, d.Date);
133 }
134 #endregion
135
136 #region Converters
137 [TestMethod]
138 public void TestConverters()
139 {
140 DateTime d = Csla.SmartDate.StringToDate("1/1/2005");
141 Assert.AreEqual("1/1/2005", d.ToShortDateString());
142 d = Csla.SmartDate.StringToDate("january-1-2005");
143 Assert.AreEqual("1/1/2005", d.ToShortDateString());
144 d = Csla.SmartDate.StringToDate(".");
145 Assert.AreEqual(DateTime.Now.ToShortDateString(), d.ToShortDateString());
146 d = Csla.SmartDate.StringToDate("-");
147 Assert.AreEqual(DateTime.Now.AddDays(-1.0).ToShortDateString(), d.ToShortDateString());
148 d = Csla.SmartDate.StringToDate("+");
149 Assert.AreEqual(DateTime.Now.AddDays(1.0).ToShortDateString(), d.ToShortDateString());
150 try
151 {
152 d = Csla.SmartDate.StringToDate("Invalid Date");
153 }
154 catch (Exception ex)
155 {
156 Assert.IsTrue(ex is System.ArgumentException);
157 }
158
160 Assert.AreEqual(DateTime.MinValue, d);
161 d = Csla.SmartDate.StringToDate(null);
162 Assert.AreEqual(DateTime.MinValue, d);
163
164 d = Csla.SmartDate.StringToDate("", true);
165 Assert.AreEqual(DateTime.MinValue, d);
166 d = Csla.SmartDate.StringToDate("", false);
167 Assert.AreEqual(DateTime.MaxValue, d);
168 try
169 {
170 d = Csla.SmartDate.StringToDate("Invalid Date", true);
171 }
172 catch (Exception ex)
173 {
174 Assert.IsTrue(ex is ArgumentException);
175 }
176 try
177 {
178 d = Csla.SmartDate.StringToDate("Invalid Date", false);
179 }
180 catch (Exception ex)
181 {
182 Assert.IsTrue(ex is ArgumentException);
183 }
184 d = Csla.SmartDate.StringToDate(null, true);
185 Assert.AreEqual(DateTime.MinValue, d);
186 d = Csla.SmartDate.StringToDate(null, false);
187 Assert.AreEqual(DateTime.MaxValue, d);
188
189 d = new DateTime(2005, 1, 2);
190 string date = Csla.SmartDate.DateToString(d, "dd/MM/yyyy");
191 Assert.AreEqual("02/01/2005", date, "dd/MM/yyyy test");
192 date = Csla.SmartDate.DateToString(d, "MM/dd/yy");
193 Assert.AreEqual("01/02/05", date, "MM/dd/yy test");
194 date = Csla.SmartDate.DateToString(d, "");
195 Assert.AreEqual("1/2/2005 12:00:00 AM", date);
196 date = Csla.SmartDate.DateToString(d, "d");
197 Assert.AreEqual("1/2/2005", date);
198 date = new Csla.SmartDate(d).ToString();
199 Assert.AreEqual("1/2/2005", date);
200
201 date = Csla.SmartDate.DateToString(DateTime.MinValue, "dd/MM/yyyy", true);
202 Assert.AreEqual("", date, "MinValue w/ emptyIsMin=true");
203 date = Csla.SmartDate.DateToString(DateTime.MinValue, "dd/MM/yyyy", false);
204 Assert.AreEqual(DateTime.MinValue.ToString("dd/MM/yyyy"), date, "MinValue w/ emptyIsMin=false");
205 date = Csla.SmartDate.DateToString(DateTime.MaxValue, "dd/MM/yyyy", true);
206 Assert.AreEqual(DateTime.MaxValue.ToString("dd/MM/yyyy"), date, "MaxValue w/ emptyIsMin=true");
207 date = Csla.SmartDate.DateToString(DateTime.MaxValue, "dd/MM/yyyy", false);
208 Assert.AreEqual("", date, "MaxValue w/ emptyIsMin=false");
209 }
210 #endregion
211
212#if !WINDOWS_PHONE
213 #region Add
214 [TestMethod()]
215 public void Add()
216 {
217 Csla.SmartDate d2 = new Csla.SmartDate();
218 Csla.SmartDate d3;
219
220 d2.Date = new DateTime(2005, 1, 1);
221 d3 = new Csla.SmartDate(d2.Add(new TimeSpan(30, 0, 0, 0)));
222 Assert.AreEqual(d2.Date.AddDays(30), d3.Date, "Dates should be equal");
223
224 Assert.AreEqual(d3, d2 + new TimeSpan(30, 0, 0, 0, 0), "Dates should be equal");
225 }
226 #endregion
227
228 #region Subtract
229 [TestMethod()]
230 public void Subtract()
231 {
232 Csla.SmartDate d2 = new Csla.SmartDate();
233 Csla.SmartDate d3;
234
235 d2.Date = new DateTime(2005, 1, 1);
236 d3 = new Csla.SmartDate(d2.Subtract(new TimeSpan(30, 0, 0, 0)));
237 Assert.AreEqual(d2.Date.AddDays(-30), d3.Date, "Dates should be equal");
238
239 Assert.AreEqual(30, ((TimeSpan)(d2 - d3)).Days, "Should be 30 days different");
240 Assert.AreEqual(d3, d2 - new TimeSpan(30, 0, 0, 0, 0), "Should be equal");
241 }
242 #endregion
243#endif
244
245 #region Comparison
246 [TestMethod()]
247 public void Comparison()
248 {
249 Csla.SmartDate d2 = new Csla.SmartDate(true);
250 Csla.SmartDate d3 = new Csla.SmartDate(false);
253
254 Assert.IsTrue(d2.Equals(d3), "Empty dates should be equal");
255 Assert.IsTrue(Csla.SmartDate.Equals(d2, d3), "Empty dates should be equal (shared)");
256 Assert.IsTrue(d2.Equals(d3), "Empty dates should be equal (unary)");
257 Assert.IsTrue(d2.Equals(""), "Should be equal to an empty string (d2)");
258 Assert.IsTrue(d3.Equals(""), "Should be equal to an empty string (d3)");
259
260 Assert.IsTrue(d2.Date.Equals(DateTime.MinValue), "Should be DateTime.MinValue");
261 Assert.IsTrue(d3.Date.Equals(DateTime.MaxValue), "Should be DateTime.MaxValue");
262
263 Assert.IsTrue(d4.Date.Equals(DateTime.MinValue), "Should be DateTime.MinValue (d4)");
264 Assert.IsTrue(d5.Date.Equals(DateTime.MaxValue), "Should be DateTime.MaxValue (d5)");
265
266 d2.Date = new DateTime(2005, 1, 1);
267 d3 = new Csla.SmartDate(d2.Date, d2.EmptyIsMin);
268 Assert.AreEqual(d2, d3, "Assigned dates should be equal");
269
270 d3.Date = new DateTime(2005, 2, 2);
271 Assert.AreEqual(1, d3.CompareTo(d2), "Should be greater than");
272 Assert.AreEqual(-1, d2.CompareTo(d3), "Should be less than");
273 Assert.IsFalse(d2.CompareTo(d3) == 0, "should not be equal");
274
275 d3.Date = new DateTime(2005, 1, 1);
276 Assert.IsFalse(1 == d2.CompareTo(d3), "should be equal");
277 Assert.IsFalse(-1 == d2.CompareTo(d3), "should be equal");
278 Assert.AreEqual(0, d2.CompareTo(d3), "should be equal");
279
280 Assert.IsTrue(d3.Equals("1/1/2005"), "Should be equal to string date");
281 Assert.IsTrue(d3.Equals(new DateTime(2005, 1, 1)), "should be equal to DateTime");
282
283 Assert.IsTrue(d3.Equals(d2.Date.ToString()), "Should be equal to any date time string");
284 Assert.IsTrue(d3.Equals(d2.Date.ToLongDateString()), "Should be equal to any date time string");
285 Assert.IsTrue(d3.Equals(d2.Date.ToShortDateString()), "Should be equal to any date time string");
286 Assert.IsFalse(d3.Equals(""), "Should not be equal to a blank string");
287
288 //DateTime can be compared using all sorts of formats but the SmartDate cannot.
289 //DateTime dt = DateTime.Now;
290 //long ldt = dt.ToBinary();
291 //Assert.IsTrue(dt.Equals(ldt), "Should be equal");
292 //Should smart date also be converted into these various types?
293 }
294 #endregion
295
296 #region Empty
297 [TestMethod()]
298 public void Empty()
299 {
300 Csla.SmartDate d2 = new Csla.SmartDate();
301 Csla.SmartDate d3;
302
303 d3 = new Csla.SmartDate(d2.Add(new TimeSpan(30, 0, 0, 0)));
304 Assert.AreEqual(d2, d3, "Dates should be equal");
305 Assert.AreEqual("", d2.Text, "Text should be empty");
306
307 d3 = new Csla.SmartDate(d2.Subtract(new TimeSpan(30, 0, 0, 0)));
308 Assert.AreEqual(d2, d3, "Dates should be equal");
309 Assert.AreEqual("", d2.Text, "Text should be empty");
310
311 d3 = new Csla.SmartDate();
312 Assert.AreEqual(0, d2.CompareTo(d3), "d2 and d3 should be the same");
313 Assert.IsTrue(d2.Equals(d3), "d2 and d3 should be the same");
314 Assert.IsTrue(Csla.SmartDate.Equals(d2, d3), "d2 and d3 should be the same");
315
316 d3.Date = DateTime.Now;
317 Assert.AreEqual(-1, d2.CompareTo(d3), "d2 and d3 should not be the same");
318 Assert.AreEqual(1, d3.CompareTo(d2), "d2 and d3 should not be the same");
319 Assert.IsFalse(d2.Equals(d3), "d2 and d3 should not be the same");
320 Assert.IsFalse(Csla.SmartDate.Equals(d2, d3), "d2 and d3 should not be the same");
321 Assert.IsFalse(d3.Equals(d2), "d2 and d3 should not be the same");
322 Assert.IsFalse(Csla.SmartDate.Equals(d3, d2), "d2 and d3 should not be the same");
323 }
324
325 [TestMethod]
326 public void MaxDateMaxValue()
327 {
328 // test for maxDateValue
329
330 Csla.SmartDate target = new Csla.SmartDate(Csla.SmartDate.EmptyValue.MaxDate);
331
332 DateTime expected = DateTime.MaxValue;
333
334 DateTime actual = target.Date;
335
336 Assert.AreEqual(expected, actual);
337 }
338
339 #endregion
340
341 #region Comparison Operators
342 [TestMethod()]
344 {
345 Csla.SmartDate d1 = new Csla.SmartDate();
346 Csla.SmartDate d2 = new Csla.SmartDate();
347
348 d1.Date = new DateTime(2005, 1, 1);
349 d2.Date = new DateTime(2005, 2, 1);
350 Assert.IsTrue(d1 < d2, "d1 should be less than d2");
351 d1.Date = new DateTime(2005, 2, 1);
352 d2.Date = new DateTime(2005, 2, 1);
353 Assert.IsFalse(d1 < d2, "d1 should be equal to d2");
354 d1.Date = new DateTime(2005, 3, 1);
355 d2.Date = new DateTime(2005, 2, 1);
356 Assert.IsFalse(d1 < d2, "d1 should be greater than d2");
357
358 d1.Date = new DateTime(2005, 3, 1);
359 d2.Date = new DateTime(2005, 2, 1);
360 Assert.IsTrue(d1 > d2, "d1 should be greater than d2");
361 d1.Date = new DateTime(2005, 2, 1);
362 d2.Date = new DateTime(2005, 2, 1);
363 Assert.IsFalse(d1 > d2, "d1 should be equal to d2");
364 d1.Date = new DateTime(2005, 1, 1);
365 d2.Date = new DateTime(2005, 2, 1);
366 Assert.IsFalse(d1 > d2, "d1 should be less than d2");
367
368 d1.Date = new DateTime(2005, 2, 1);
369 d2.Date = new DateTime(2005, 2, 1);
370 Assert.IsTrue(d1 == d2, "d1 should be equal to d2");
371 d1.Date = new DateTime(2005, 1, 1);
372 d2.Date = new DateTime(2005, 2, 1);
373 Assert.IsFalse(d1 == d2, "d1 should not be equal to d2");
374
375 //#warning Smart date does not overload the <= or >= operators!
376 //Assert.Fail("Missing <= and >= operators");
377 d1.Date = new DateTime(2005, 1, 1);
378 d2.Date = new DateTime(2005, 2, 1);
379 Assert.IsTrue(d1 <= d2, "d1 should be less than or equal to d2");
380 d1.Date = new DateTime(2005, 2, 1);
381 Assert.IsTrue(d1 <= d2, "d1 should be less than or equal to d2");
382 d1.Date = new DateTime(2005, 3, 1);
383 Assert.IsFalse(d1 <= d2, "d1 should be greater than to d2");
384
385 d1.Date = new DateTime(2005, 3, 1);
386 d2.Date = new DateTime(2005, 2, 1);
387 Assert.IsTrue(d1 >= d2, "d1 should be greater than or equal to d2");
388 d1.Date = new DateTime(2005, 2, 1);
389 Assert.IsTrue(d1 >= d2, "d1 should be greater than or equal to d2");
390 d1.Date = new DateTime(2005, 1, 1);
391 Assert.IsFalse(d1 >= d2, "d1 should be less than to d2");
392
393 d1.Date = new DateTime(2005, 1, 1);
394 d2.Date = new DateTime(2005, 2, 1);
395 Assert.IsTrue(d1 != d2, "d1 should not be equal to d2");
396 d1.Date = new DateTime(2005, 2, 1);
397 Assert.IsFalse(d1 != d2, "d1 should be equal to d2");
398 d1.Date = new DateTime(2005, 3, 1);
399 Assert.IsTrue(d1 != d2, "d1 should be greater than d2");
400 }
401
402 [TestMethod]
403 public void TryParseTest()
404 {
405 Csla.SmartDate sd = new Csla.SmartDate();
406 if (Csla.SmartDate.TryParse("blah", ref sd))
407 Assert.AreEqual(true, false, "TryParse should have failed");
408 if (Csla.SmartDate.TryParse("t", ref sd))
409 Assert.AreEqual(DateTime.Now.Date, sd.Date.Date, "Date should have been now");
410 else
411 Assert.AreEqual(true, false, "TryParse should have succeeded");
412 }
413
414 #endregion
415
416 #region Serialization
417 [TestMethod()]
418 public void SerializationTest()
419 {
420 Csla.SmartDate d2;
421 Csla.SmartDate clone;
422 MemoryStream memoryStream;
423 MobileFormatter mobileFormatter;
424 ApplicationContext applicationContext = _testDIContext.CreateTestApplicationContext();
425
426 d2 = new Csla.SmartDate();
427 memoryStream = new MemoryStream();
428 mobileFormatter = new MobileFormatter(applicationContext);
429 mobileFormatter.Serialize(memoryStream, d2);
430 memoryStream.Seek(0, SeekOrigin.Begin);
431 clone = (Csla.SmartDate)mobileFormatter.Deserialize(memoryStream);
432 Assert.AreEqual(d2, clone, "Dates should have ben the same");
433
434 d2 = new Csla.SmartDate(DateTime.Now, false);
435 memoryStream = new MemoryStream();
436 mobileFormatter = new MobileFormatter(applicationContext);
437 mobileFormatter.Serialize(memoryStream, d2);
438 memoryStream.Seek(0, SeekOrigin.Begin);
439 clone = (Csla.SmartDate)mobileFormatter.Deserialize(memoryStream);
440 Assert.AreEqual(d2, clone, "Dates should have ben the same");
441
442 d2 = new Csla.SmartDate(DateTime.Now.AddDays(10), false);
443 d2.FormatString = "YYYY/DD/MM";
444 memoryStream = new MemoryStream();
445 mobileFormatter = new MobileFormatter(applicationContext);
446 mobileFormatter.Serialize(memoryStream, d2);
447 memoryStream.Seek(0, SeekOrigin.Begin);
448 clone = (Csla.SmartDate)mobileFormatter.Deserialize(memoryStream);
449 Assert.AreEqual(d2, clone, "Dates should have ben the same");
450
451 //cslalighttest.Serialization.PersonWIthSmartDateField person;
452 //person = cslalighttest.Serialization.PersonWIthSmartDateField.GetPersonWIthSmartDateField("Sergey", 2000);
453 //Assert.AreEqual(person.Birthdate, person.Clone().Birthdate, "Dates should have ben the same");
454 //
455 //Csla.SmartDate expected = person.Birthdate;
456 //person.BeginEdit();
457 //person.Birthdate = new Csla.SmartDate(expected.Date.AddDays(10)); // to guarantee it's a different value
458 //person.CancelEdit();
459 //Csla.SmartDate actual = person.Birthdate;
460 //Assert.AreEqual(expected, actual);
461
462 }
463 #endregion
464
465 [TestMethod]
466 public void DefaultFormat()
467 {
468 IDataPortal<SDtest> dataPortal = _testDIContext.CreateDataPortal<SDtest>();
469
471
472 var obj = SDtest.NewSDTest(dataPortal);
473 Assert.AreEqual("", obj.TextDate, "Should be empty");
474
475 var now = DateTime.Now;
476 obj.TextDate = string.Format("{0:g}", now);
477 Assert.AreEqual(string.Format("{0:g}", now), obj.TextDate, "Should be today");
478 }
479
480
481 [TestMethod]
483 {
485 {
486 if (s == "test") return DateTime.Now;
487 return null;
488 };
489
490 // uses custom parser
491 var date = new Csla.SmartDate("test");
492 Assert.AreEqual(DateTime.Now.Date, date.Date.Date);
493
494 // uses buildin parser
495 var date2 = new Csla.SmartDate("t");
496 Assert.AreEqual(DateTime.Now.Date, date.Date.Date);
497 }
498 }
499
501 public class SDtest : BusinessBase<SDtest>
502 {
504 RegisterProperty<Csla.SmartDate>(c => c.TextDate, null, new Csla.SmartDate { FormatString = "g" });
505 public string TextDate
506 {
507 get { return GetPropertyConvert<Csla.SmartDate, string>(TextDateProperty); }
508 set { SetPropertyConvert<Csla.SmartDate, string>(TextDateProperty, value); }
509 }
510
511 public static PropertyInfo<Csla.SmartDate> MyDateProperty = RegisterProperty<Csla.SmartDate>(c => c.MyDate);
513 {
514 get { return GetProperty(MyDateProperty); }
515 set { SetProperty(MyDateProperty, value); }
516 }
517
518 public static SDtest NewSDTest(IDataPortal<SDtest> dataPortal)
519 {
520 return dataPortal.Create();
521 }
522
523 [Create]
524 private void Create()
525 {
526 }
527 }
528}
Provides consistent context information between the client and server DataPortal objects.
This is the base class from which most business objects will be derived.
Definition: BusinessBase.cs:38
Maintains metadata about a property.
Serializes and deserializes objects at the field level.
object Deserialize(Stream serializationStream)
Deserialize an object from XML.
void Serialize(Stream serializationStream, object graph)
Serialize an object graph into XML.
static SDtest NewSDTest(IDataPortal< SDtest > dataPortal)
static PropertyInfo< Csla.SmartDate > MyDateProperty
static PropertyInfo< Csla.SmartDate > TextDateProperty
static void ClassInitialize(TestContext context)
Static dictionary-like class that offers similar functionality to GlobalContext This is used in tests...
Definition: TestResults.cs:21
static void Reinitialise()
Reinitialise the dictionary, clearing any existing results, ready for the next test
Definition: TestResults.cs:69
Interface defining the members of the data portal type.
Definition: IDataPortalT.cs:17
object Create(params object[] criteria)
Called by a factory method in a business class to create a new object, which is loaded with default v...
@ Serializable
Prevents updating or inserting until the transaction is complete.
Provides a date data type that understands the concept of an empty date value.
Definition: SmartDate.cs:32
EmptyValue
Indicates the empty value of a SmartDate.
Definition: SmartDate.cs:52
DateTime? Date
Gets or sets the date value.
Definition: SmartDate.cs:413
static DateTime StringToDate(string value)
Converts a text date representation into a Date value.
Definition: SmartDate.cs:668
override string ToString()
Returns a text representation of the date value.
Definition: SmartDate.cs:456
static bool TryParse(string value, ref SmartDate result)
Converts a string value into a SmartDate.
Definition: SmartDate.cs:633
static string DateToString(DateTime value, string formatString)
Converts a date value into a text representation.
Definition: SmartDate.cs:775
string FormatString
Gets or sets the format string used to format a date value when it is returned as text.
Definition: SmartDate.cs:371
override bool Equals(object obj)
Compares this object to another SmartDate for equality.
Definition: SmartDate.cs:480
static Func< string, DateTime?> CustomParser
Gets or sets the custom parser.
Definition: SmartDate.cs:586