Пример #1
0
        public void SimpleAppConfigurationFillsCorrectly()
        {
            // Arrange
            TestAppConfigurationLongPropertyName configuration = new TestAppConfigurationLongPropertyName();

            // Assert
            VerifyConfiguration(configuration);
        }
Пример #2
0
        private static void VerifyConfiguration(TestAppConfigurationLongPropertyName configuration)
        {
            // Verify simple properties
            configuration.StringProperty.ShouldBe("test-value-long");
            configuration.BoolProperty.ShouldBe(true);
            configuration.DecimalProperty.ShouldBe((decimal)12.32);

            // Verify struct properties
            configuration.TimeSpanProperty.ShouldBe(TimeSpan.Parse("11:17:07.2787"));
            configuration.GuidProperty.ShouldBe(new Guid("63A0848A-586B-4108-867B-2980B0443401"));

            // Verify a first level complex property
            configuration.SomeComplexProperty.ShouldNotBeNull();
            configuration.SomeComplexProperty.Name.ShouldBe("long-complex-name");
            configuration.SomeComplexProperty.Id.ShouldBe(new Guid("296DE560-59E7-4EA1-A838-4700B1DACE50"));
            configuration.SomeComplexProperty.Price.ShouldBe((decimal)128.290);

            // Verify a second level complex property
            configuration.SomeComplexProperty.ComplexProperty.ShouldNotBeNull();
            configuration.SomeComplexProperty.ComplexProperty.Expiration.ShouldBe(TimeSpan.Parse("17.17:36:05"));
            configuration.SomeComplexProperty.ComplexProperty.Amount.ShouldBe(27.56);

            // Verify a third level complex property
            configuration.SomeComplexProperty.ComplexProperty.Value.ShouldNotBeNull();
            configuration.SomeComplexProperty.ComplexProperty.Value.Expiration.ShouldBe(TimeSpan.Parse("11:37:20.298"));
            configuration.SomeComplexProperty.ComplexProperty.Value.Amount.ShouldBe(21.23678);
            configuration.SomeComplexProperty.ComplexProperty.Value.Value.ShouldBeNull();

            // Verify enumerable properties
            configuration.StringList.ShouldNotBeNull();
            configuration.StringList.Count.ShouldBe(4);
            configuration.StringList[0].ShouldBe("item2-1");
            configuration.StringList[1].ShouldBe("item2-278");
            configuration.StringList[2].ShouldBe("item-267");
            configuration.StringList[3].ShouldBe("list2789");
        }