Exemple #1
0
        public void GivenASearchValue_WhenToStringIsCalled_ThenCorrectStringShouldBeReturned()
        {
            DateTimeSearchValue value = DateTimeSearchValue.Parse("2017");

            Assert.NotNull(value);
            Assert.Equal("2017-01-01T00:00:00.0000000+00:00-2017-12-31T23:59:59.9999999+00:00", value.ToString());
        }
        public void GivenASearchValue_WhenToStringIsCalled_ThenCorrectStringShouldBeReturned()
        {
            DateTimeSearchValue value = DateTimeSearchValue.Parse("2017");

            Assert.NotNull(value);
            Assert.Equal("2017", value.ToString());
        }
Exemple #3
0
        public void GivenAValidString_WhenParsed_ThenCorrectSearchValueShouldBeReturned(string input, string expectedStart, string expectedEnd)
        {
            DateTimeSearchValue value = DateTimeSearchValue.Parse(input);
            DateTimeOffset      expectedStartDateTime = DateTimeOffset.Parse(expectedStart);
            DateTimeOffset      expectedEndDateTime   = DateTimeOffset.Parse(expectedEnd);

            Assert.NotNull(value);
            Assert.Equal(expectedStartDateTime, value.Start);
            Assert.Equal(expectedEndDateTime, value.End);
        }
Exemple #4
0
        public void GivenASearchValue_WhenCompareWithDateSearchValue_ThenCorrectResultIsReturned(string original, string given, int expectedMinResult, int expectedMaxResult)
        {
            DateTimeSearchValue originalValue = DateTimeSearchValue.Parse(original);
            DateTimeSearchValue givenValue    = DateTimeSearchValue.Parse(given);

            int minResult = originalValue.CompareTo(givenValue, ComparisonRange.Min);
            int maxResult = originalValue.CompareTo(givenValue, ComparisonRange.Max);

            Assert.Equal(expectedMinResult, minResult);
            Assert.Equal(expectedMaxResult, maxResult);
        }
Exemple #5
0
        public void GivenAStringSearchValue_WhenCompareWithNull_ThenArgumentExceptionIsThrown()
        {
            DateTimeSearchValue value = DateTimeSearchValue.Parse("2020");

            Assert.Throws <ArgumentException>(() => value.CompareTo(null, ComparisonRange.Max));
        }
Exemple #6
0
 public void GivenAnInvalidString_WhenParsing_ThenExceptionShouldBeThrown(string s)
 {
     Assert.Throws <ArgumentException>(ParamNameS, () => DateTimeSearchValue.Parse(s));
 }
Exemple #7
0
 public void GivenANullString_WhenParsing_ThenExceptionShouldBeThrown()
 {
     Assert.Throws <ArgumentNullException>(ParamNameS, () => DateTimeSearchValue.Parse(null));
 }