public void Constructor4_NullAsContractTypeArgument_ShouldSetContractNamePropertyToEmptyString() { var attribute = new ExportAttribute((string)null, (Type)null); Assert.IsNull(attribute.ContractName); Assert.IsNull(attribute.ContractType); }
public void Constructor1_ShouldSetContractNamePropertyToEmptyString() { var attribute = new ExportAttribute(); Assert.IsNull(attribute.ContractName); Assert.IsNull(attribute.ContractType); }
public void Constructor2_ValueAsContractNameArgument_ShouldSetContractNameProperty() { var expectations = Expectations.GetContractNamesWithEmpty(); foreach (var e in expectations) { var attribute = new ExportAttribute(e); Assert.AreEqual(e, attribute.ContractName); } }
public AttributedExportDefinition(AttributedPartCreationInfo partCreationInfo, MemberInfo member, ExportAttribute exportAttribute) : base(member.GetContractNameFromExport(exportAttribute), (IDictionary<string, object>)null) { Assumes.NotNull(partCreationInfo); Assumes.NotNull(member); Assumes.NotNull(exportAttribute); this._partCreationInfo = partCreationInfo; this._member = member; this._exportAttribute = exportAttribute; }
public AttributedExportDefinition(AttributedPartCreationInfo partCreationInfo, MemberInfo member, ExportAttribute exportAttribute, Type typeIdentityType, string contractName) : base(contractName, (IDictionary<string, object>)null) { Assumes.NotNull(partCreationInfo); Assumes.NotNull(member); Assumes.NotNull(exportAttribute); this._partCreationInfo = partCreationInfo; this._member = member; this._exportAttribute = exportAttribute; this._typeIdentityType = typeIdentityType; }
public void AsContractName_AndContractType_SetsContractNameAndType() { var builder = new ExportBuilder(); builder.AsContractName("hey"); builder.AsContractType(typeof(IFoo)); ExportAttribute exportAtt = GetExportAttribute(builder); Assert.AreEqual("hey", exportAtt.ContractName); Assert.AreEqual(typeof(IFoo), exportAtt.ContractType); }
Type GetTypeFromContractNameAsILayoutItem(ExportAttribute attribute) { if (attribute == null) return null; string typeName; if ((typeName = attribute.ContractName) == null) return null; var type = Type.GetType(typeName); if (type == null || !typeof(ILayoutItem).IsInstanceOfType(type)) return null; return type; }
public void ShouldExportTheGameSystem() { var exportAsGameSystem = new ExportAttribute(typeof (GameSystem)); typeof (Model.SenseOfWonder).GetCustomAttributes(typeof (ExportAttribute), false) .Should().Equal(exportAsGameSystem); }