Пример #1
0
        public void XsdDuration_TestHashUsesNanoseconds()
        {
            var x = new XsdDuration(nanoseconds: 3).GetHashCode();
            var y = new XsdDuration(nanoseconds: 2).GetHashCode();

            x.Should().NotBe(y);
        }
Пример #2
0
        public void XsdDuration_TestEqualsChecksNegative()
        {
            var x = new XsdDuration(negative: true);
            var y = new XsdDuration(negative: false);

            x.Should().NotBe(y);
        }
Пример #3
0
        public void XsdDuration_TestHashUsesNegative()
        {
            var x = new XsdDuration(negative: true).GetHashCode();
            var y = new XsdDuration(negative: false).GetHashCode();

            x.Should().NotBe(y);
        }
Пример #4
0
        public void XsdDuration_TestHashUsesMinutes()
        {
            var x = new XsdDuration(minutes: 3).GetHashCode();
            var y = new XsdDuration(minutes: 2).GetHashCode();

            x.Should().NotBe(y);
        }
Пример #5
0
        public void XsdDuration_TestEqualsChecksSeconds()
        {
            var x = new XsdDuration(seconds: 5);
            var y = new XsdDuration(seconds: 6);

            x.Should().NotBe(y);
        }
Пример #6
0
        public void XsdDuration_TestEqualsChecksNanoseconds()
        {
            var x = new XsdDuration(nanoseconds: 31323);
            var y = new XsdDuration(nanoseconds: 99099);

            x.Should().NotBe(y);
        }
Пример #7
0
        public void XsdDuration_TestEqualsChecksDays()
        {
            var x = new XsdDuration(days: 1);
            var y = new XsdDuration(days: 2);

            x.Should().NotBe(y);
        }
Пример #8
0
        public void XsdDuration_TestEqualsChecksMinutes()
        {
            var x = new XsdDuration(minutes: 1);
            var y = new XsdDuration(minutes: 3);

            x.Should().NotBe(y);
        }
Пример #9
0
 /// <summary>
 /// Ctor
 /// </summary>
 public SPOptions()
 {
     MetadataCacheDuration       = new XsdDuration(hours: 1);
     Compatibility               = new Compatibility();
     OutboundSigningAlgorithm    = XmlHelpers.GetDefaultSigningAlgorithmName();
     MinIncomingSigningAlgorithm = XmlHelpers.GetDefaultSigningAlgorithmName();
 }
Пример #10
0
        public void XsdDuration_TestEqualsOtherType()
        {
            var duration    = new XsdDuration(hours: 1);
            var notDuration = new DateTime(2001, 01, 01);

            duration.Equals(notDuration).Should().Be(false);
        }
Пример #11
0
        public void XsdDuration_TestEqualsChecksHours()
        {
            var x = new XsdDuration(hours: 3);
            var y = new XsdDuration(hours: 2);

            x.Should().NotBe(y);
        }
Пример #12
0
 /// <summary>
 /// Ctor
 /// </summary>
 public SPOptions()
 {
     systemIdentityModelIdentityConfiguration = new IdentityConfiguration(false);
     MetadataCacheDuration       = new XsdDuration(hours: 1);
     Compatibility               = new Compatibility();
     OutboundSigningAlgorithm    = XmlHelpers.GetDefaultSigningAlgorithmName();
     MinIncomingSigningAlgorithm = XmlHelpers.GetDefaultSigningAlgorithmName();
 }
Пример #13
0
        public void XsdDuration_ToTimespanNegative()
        {
            var duration = new XsdDuration(negative: true, years: 6, months: 5,
                                           days: 4, hours: 3, minutes: 2, seconds: 1, nanoseconds: 100000000);

            duration.ToTimeSpan().Should().Be(
                new TimeSpan(365 * 6 + 5 * 30 + 4, 3, 2, 1, 100).Negate());
        }
Пример #14
0
        public void XsdDuration_ToTimespan()
        {
            var duration = new XsdDuration(negative: false, years: 1, months: 2,
                                           days: 3, hours: 4, minutes: 5, seconds: 6, nanoseconds: 1000000);

            duration.ToTimeSpan().Should().Be(
                new TimeSpan(365 * 1 + 2 * 30 + 3, 4, 5, 6, 1));
        }
Пример #15
0
        public void XsdDuration_TestTimespanCtor()
        {
            XsdDuration duration = new XsdDuration(new TimeSpan(99, 13, 24, 11, 33));

            duration.Days.Should().Be(99);
            duration.Hours.Should().Be(13);
            duration.Minutes.Should().Be(24);
            duration.Seconds.Should().Be(11);
            duration.Nanoseconds.Should().Be(33000000);
        }
Пример #16
0
        public void XsdDuration_TestComponentsCtor()
        {
            XsdDuration duration = new XsdDuration(true, 12, 10, 8, 6, 4, 2, 147);

            duration.Negative.Should().Be(true);
            duration.Years.Should().Be(12);
            duration.Months.Should().Be(10);
            duration.Days.Should().Be(8);
            duration.Hours.Should().Be(6);
            duration.Minutes.Should().Be(4);
            duration.Seconds.Should().Be(2);
            duration.Nanoseconds.Should().Be(147);
        }
Пример #17
0
        ///<include file='doc\XmlConvert.uex' path='docs/doc[@for="XmlConvert.ToTimeSpan"]/*' />
        /// <devdoc>
        ///    <para>[To be supplied.]</para>
        /// </devdoc>
        public static TimeSpan ToTimeSpan(string s)
        {
            XsdDuration duration;
            TimeSpan    timeSpan;

            try
            {
                duration = new XsdDuration(s);
            }
            catch (Exception)
            {
                // Remap exception for v1 compatibility
                throw new FormatException(SR.Format(SR.XmlConvert_BadFormat, s, "TimeSpan"));
            }

            timeSpan = duration.ToTimeSpan();

            return(timeSpan);
        }
Пример #18
0
        public void XsdDuration_TestParseInvalidStart()
        {
            Action a = () => XsdDuration.Parse("X");

            a.Should().Throw <FormatException>();
        }
Пример #19
0
 public void XsdDuration_ParseNoComponents()
 {
     XsdDuration.TryParse("PT", out XsdDuration xsdDuration)
     .Should().Be(false);
 }
Пример #20
0
        public void XsdDuration_TestParseEmpty()
        {
            Action a = () => XsdDuration.Parse("");

            a.Should().Throw <FormatException>();
        }
Пример #21
0
 public void XsdDuration_ParseTrailingNumAfterTM()
 {
     XsdDuration.TryParse("PT30M4", out XsdDuration xsdDuration)
     .Should().Be(false);
 }
Пример #22
0
 public void XsdDuration_ParseDT()
 {
     XsdDuration.Parse("P30DT14M")
     .Should().Be(new XsdDuration(days: 30, minutes: 14));
 }
Пример #23
0
 public void XsdDuration_TestTrailingText()
 {
     XsdDuration.TryParse("PT0.0Srubbish", out XsdDuration result)
     .Should().Be(false);
 }
Пример #24
0
 public void XsdDuration_ParseInvalidAfterDay()
 {
     XsdDuration.TryParse("P6Dinvalid", out XsdDuration xsdDuration)
     .Should().Be(false);
 }
Пример #25
0
 public void XsdDuration_TestTryParseNull()
 {
     XsdDuration.TryParse(null, out XsdDuration result)
     .Should().Be(false);
 }
Пример #26
0
        public void XsdDuration_TestParseNull()
        {
            Action a = () => XsdDuration.Parse(null);

            a.Should().Throw <ArgumentNullException>();
        }
Пример #27
0
 public void XsdDuration_TestEmpty()
 {
     XsdDuration.TryParse("", out XsdDuration result)
     .Should().Be(false);
 }
Пример #28
0
 public void XsdDuration_ParseMT()
 {
     XsdDuration.Parse("P30MT14M")
     .Should().Be(new XsdDuration(months: 30, minutes: 14));
 }
Пример #29
0
 public void XsdDuration_TestEmptyTime()
 {
     XsdDuration.TryParse("P14YT", out XsdDuration xsdDuration)
     .Should().Be(false);
 }
Пример #30
0
        public void XsdDuration_TestParseLargeNS()
        {
            var result = XsdDuration.Parse("PT0.1234567890123456789S");

            result.Should().Be(new XsdDuration(nanoseconds: 123456789));
        }