public void Constructor_OutOfRangeValueAsCreationPolicyArgument_ShouldSetCreationPolicy()
        {   // Attributes should not throw exceptions
            var expectations = Expectations.GetInvalidEnumValues <CreationPolicy>();

            foreach (var e in expectations)
            {
                var attribute = new PartCreationPolicyAttribute(e);

                Assert.AreEqual(e, attribute.CreationPolicy);
            }
        }
Beispiel #2
0
        public void Constructor2_OutOfRangeValueAsCardinalityArgument_ShouldThrowArgument()
        {
            var expectations = Expectations.GetInvalidEnumValues <ImportCardinality>();

            foreach (var e in expectations)
            {
                Assert.Throws <ArgumentException>("cardinality", () =>
                {
                    new ContractBasedImportDefinition("ContractName", (string)null, Enumerable.Empty <KeyValuePair <string, Type> >(), e, false, false, CreationPolicy.Any);
                });
            }
        }
Beispiel #3
0
        public void Constructor2_OutOfRangeValueAsCardinalityArgument_ShouldThrowArgument()
        {
            var expectations = Expectations.GetInvalidEnumValues <ImportCardinality>();

            foreach (var e in expectations)
            {
                Assert.Throws <ArgumentException>("cardinality", () =>
                {
                    new ImportDefinition(d => true, "", e, false, false);
                });
            }
        }