コード例 #1
0
        public void ShouldThrowNotSupportedException_WhenMemberTypeIsNotSupported()
        {
            var controller             = new MemberConfigurationAccessController();
            var notSupportedMemberType = NotSupportedMemberType;

            Assert.Throws <NotSupportedException>(() => controller.CreateMemberConfigurationForType("member",
                                                                                                    notSupportedMemberType,
                                                                                                    new TypeResolvingConfiguration(typeof(object))));
            Assert.Throws <NotSupportedException>(() => controller.GetMemberConfigurationType("member",
                                                                                              notSupportedMemberType,
                                                                                              new TypeResolvingConfiguration(typeof(object))));
            Assert.Throws <NotSupportedException>(() => controller.HasMemberConfigurationType("member",
                                                                                              notSupportedMemberType,
                                                                                              new TypeResolvingConfiguration(typeof(object))));
        }
コード例 #2
0
        public void ShouldSupportSupportedMemberTypes()
        {
            var supportConsultant = new MemberTypeSupportConsultant();
            var controller        = new MemberConfigurationAccessController();

            foreach (var supportedMemberType in supportConsultant.SupportedTypes)
            {
                // absence of NotSupportedExceptions means type is supported
                controller.CreateMemberConfigurationForType("member", supportedMemberType,
                                                            new TypeResolvingConfiguration(typeof(object)));
                controller.GetMemberConfigurationType("member", supportedMemberType,
                                                      new TypeResolvingConfiguration(typeof(object)));
                controller.HasMemberConfigurationType("member", supportedMemberType,
                                                      new TypeResolvingConfiguration(typeof(object)));
            }
        }