Beispiel #1
0
        public void Size2D_TryParse_FailsForInvalidStrings()
        {
            var result    = default(Size2D);
            var succeeded = Size2D.TryParse("foo", out result);

            TheResultingValue(succeeded)
            .ShouldBe(false);
        }
Beispiel #2
0
        public void Size2D_TryParse_SucceedsForValidStrings()
        {
            var str    = "123.45 456.78";
            var result = default(Size2D);

            if (!Size2D.TryParse(str, out result))
            {
                throw new InvalidOperationException("Unable to parse string to Size2D.");
            }

            TheResultingValue(result)
            .ShouldBe(123.45, 456.78);
        }