public void TestSingleMIALikeFilter() { SingleTestMIA mia1 = TestCommonUtils.CreateSingleMIA("Meta1", Cardinality.Inline, true, true); IFilter filter = new LikeFilter(mia1.ATTR_STRING, "%", null); ICollection <MediaItemAspectMetadata> requiredMIATypes = new List <MediaItemAspectMetadata>(); requiredMIATypes.Add(mia1.Metadata); IList <object> parts = new List <object>(); IList <BindVar> bindVars = new List <BindVar>(); MockCompiledFilter compiledFilter = new MockCompiledFilter(); compiledFilter.test(MockCore.Management, filter, null, requiredMIATypes, "test", null, parts, bindVars); //Console.WriteLine("Parts [{0}]", string.Join(",", parts)); //Console.WriteLine("Bind vars [{0}]", string.Join(",", bindVars)); Assert.AreEqual(new List <object> { new QueryAttribute(mia1.ATTR_STRING), " LIKE ", "@V0" }, parts, "Parts"); Assert.AreEqual(new List <BindVar> { new BindVar("V0", "%", typeof(string)) }, bindVars, "Bind vars"); }
public void TestMultipleMIAM() { MultipleTestMIA src = TestCommonUtils.CreateMultipleMIA("Multiple", Cardinality.Inline, true, false); TextWriter writer = new StringWriter(); XmlWriter serialiser = new XmlTextWriter(writer); serialiser.WriteStartElement("Test"); src.Metadata.Serialize(serialiser); serialiser.WriteEndElement(); Console.WriteLine("XML: {0}", writer); XmlReader reader = XmlReader.Create(new StringReader(writer.ToString())); reader.Read(); // Test tag reader.Read(); // MIAM tag MultipleMediaItemAspectMetadata dest = MediaItemAspectMetadata.Deserialize(reader) as MultipleMediaItemAspectMetadata; Assert.IsNotNull(dest, "Dest"); Assert.AreEqual(src.Metadata.AspectId, dest.AspectId, "Aspect ID"); Assert.AreEqual(src.Metadata.AttributeSpecifications.Count, dest.AttributeSpecifications.Count, "Attribute spec count"); AssertMultipleMIAMSpec(src.Metadata.AttributeSpecifications.Values, dest.AttributeSpecifications.Values, src.ATTR_STRING); Assert.IsNotNull(src.Metadata.UniqueAttributeSpecifications, "Source unique spec"); Assert.IsNotNull(dest.UniqueAttributeSpecifications, "Source unique spec"); Assert.AreEqual(src.Metadata.UniqueAttributeSpecifications.Count, dest.UniqueAttributeSpecifications.Count, "Attribute unique spec count"); AssertMultipleMIAMSpec(src.Metadata.UniqueAttributeSpecifications.Values, dest.UniqueAttributeSpecifications.Values, src.ATTR_ID); }
public static MultipleTestMIA CreateMultipleMIA(string table, Cardinality cardinality, bool createStringAttribute, bool createIntegerAttribute) { MultipleTestMIA mia = TestCommonUtils.CreateMultipleMIA(table, cardinality, createStringAttribute, createIntegerAttribute); MockCore.AddMediaItemAspectStorage(mia.Metadata); return(mia); }
public void TestExternalMediaItem() { MockDBUtils.Reset(); MockCore.SetupLibrary(); SingleTestMIA mia1 = TestCommonUtils.CreateSingleMIA("SINGLE1", Cardinality.Inline, true, true); MockCore.Management.AddMediaItemAspectStorage(mia1.Metadata); MockCore.Management.AddMediaItemAspectStorage(ProviderResourceAspect.Metadata); MockCore.Management.AddMediaItemAspectStorage(ImporterAspect.Metadata); MockCore.Management.AddMediaItemAspectStorage(ExternalIdentifierAspect.Metadata); MockCore.Management.AddMediaItemAspectStorage(MediaAspect.Metadata); IDictionary <Guid, IList <MediaItemAspect> > aspects = new Dictionary <Guid, IList <MediaItemAspect> >(); SingleMediaItemAspect aspect1 = new SingleMediaItemAspect(mia1.Metadata); aspect1.SetAttribute(mia1.ATTR_INTEGER, 1); aspect1.SetAttribute(mia1.ATTR_STRING, "one"); MediaItemAspect.SetAspect(aspects, aspect1); MediaItemAspect.AddOrUpdateExternalIdentifier(aspects, "test", ExternalIdentifierAspect.TYPE_EPISODE, "123"); MediaItemAspect.AddOrUpdateExternalIdentifier(aspects, "test", ExternalIdentifierAspect.TYPE_SERIES, "456"); MockDBUtils.AddReader(1, "SELECT MEDIA_ITEM_ID FROM M_PROVIDERRESOURCE WHERE SYSTEM_ID = @SYSTEM_ID AND PATH = @PATH", "MEDIA_ITEM_ID"); MockDBUtils.AddReader(2, "SELECT T5.MEDIA_ITEM_ID A23, T0.MEDIA_ITEM_ID A24, T1.MEDIA_ITEM_ID A25, T2.MEDIA_ITEM_ID A26, T3.MEDIA_ITEM_ID A27, T4.MEDIA_ITEM_ID A28, T0.ATTR_STRING A0, " + "T0.ATTR_INTEGER A1, T1.SYSTEM_ID A2, T1.RESOURCEINDEX A3, T1.ISPRIMARY A4, T1.MIMETYPE A5, T1.SIZE A6, T1.PATH A7, T1.PARENTDIRECTORY A8, T2.LASTIMPORTDATE A9, T2.DIRTY A10, T2.DATEADDED A11, " + "T3.SOURCE A12, T3.TYPE A13, T3.ID A14, T4.TITLE A15, T4.SORTTITLE A16, T4.RECORDINGTIME A17, T4.RATING A18, T4.COMMENT A19, T4.PLAYCOUNT A20, T4.LASTPLAYED A21, T4.ISVIRTUAL A22 FROM MEDIA_ITEMS T5 " + "LEFT OUTER JOIN M_SINGLE1 T0 ON T0.MEDIA_ITEM_ID = T5.MEDIA_ITEM_ID LEFT OUTER JOIN M_PROVIDERRESOURCE T1 ON T1.MEDIA_ITEM_ID = T5.MEDIA_ITEM_ID " + "LEFT OUTER JOIN M_IMPORTEDITEM T2 ON T2.MEDIA_ITEM_ID = T5.MEDIA_ITEM_ID LEFT OUTER JOIN M_EXTERNALIDENTIFIER T3 ON T3.MEDIA_ITEM_ID = T5.MEDIA_ITEM_ID " + "LEFT OUTER JOIN M_MEDIAITEM T4 ON T4.MEDIA_ITEM_ID = T5.MEDIA_ITEM_ID WHERE T5.MEDIA_ITEM_ID = @V0", "@V0"); string pathStr = "c:\\item.mp3"; ResourcePath path = LocalFsResourceProviderBase.ToResourcePath(pathStr); MockCore.Library.AddOrUpdateMediaItem(Guid.Empty, null, path, aspects.Values.SelectMany(x => x), false); MockCore.ShutdownLibrary(); }
public void TestSingleMIAM() { SingleTestMIA src = TestCommonUtils.CreateSingleMIA("Single", Cardinality.Inline, true, false); TextWriter writer = new StringWriter(); XmlWriter serialiser = new XmlTextWriter(writer); serialiser.WriteStartElement("Test"); // Wrapper around the albums src.Metadata.Serialize(serialiser); serialiser.WriteEndElement(); Console.WriteLine("XML: {0}", writer); XmlReader reader = XmlReader.Create(new StringReader(writer.ToString())); reader.Read(); // Test tag reader.Read(); // MIAM tag SingleMediaItemAspectMetadata dest = MediaItemAspectMetadata.Deserialize(reader) as SingleMediaItemAspectMetadata; Assert.IsNotNull(dest); Assert.AreEqual(src.Metadata.AspectId, dest.AspectId); Assert.AreEqual(src.Metadata.AttributeSpecifications.Count, dest.AttributeSpecifications.Count); MediaItemAspectMetadata.SingleAttributeSpecification srcSpec = src.Metadata.AttributeSpecifications[src.ATTR_STRING.AttributeName] as MediaItemAspectMetadata.SingleAttributeSpecification; Assert.IsNotNull(srcSpec); MediaItemAspectMetadata.SingleAttributeSpecification destSpec = dest.AttributeSpecifications[src.ATTR_STRING.AttributeName] as MediaItemAspectMetadata.SingleAttributeSpecification; Assert.IsNotNull(destSpec); Assert.AreEqual(srcSpec.AttributeName, destSpec.AttributeName); Assert.AreEqual(srcSpec.AttributeType, destSpec.AttributeType); Assert.AreEqual(srcSpec.Cardinality, destSpec.Cardinality); Assert.AreEqual(srcSpec.IsCollectionAttribute, destSpec.IsCollectionAttribute); Assert.AreEqual(srcSpec.IsIndexed, destSpec.IsIndexed); Assert.AreEqual(srcSpec.MaxNumChars, destSpec.MaxNumChars); }
public void TestEditBigMediaItem() { MockDBUtils.Reset(); MockCore.SetupLibrary(); SingleTestMIA mia1 = TestCommonUtils.CreateSingleMIA("SINGLE1", Cardinality.Inline, true, true); MockCore.Management.AddMediaItemAspectStorage(mia1.Metadata); MultipleTestMIA mia2 = TestCommonUtils.CreateMultipleMIA("MULTIPLE2", Cardinality.Inline, true, false); MockCore.Management.AddMediaItemAspectStorage(mia2.Metadata); MultipleTestMIA mia3 = TestCommonUtils.CreateMultipleMIA("MULTIPLE3", Cardinality.Inline, false, true); MockCore.Management.AddMediaItemAspectStorage(mia3.Metadata); SingleTestMIA mia4 = TestCommonUtils.CreateSingleMIA("SINGLE4", Cardinality.Inline, true, true); MockCore.Management.AddMediaItemAspectStorage(mia4.Metadata); MockCore.Management.AddMediaItemAspectStorage(ProviderResourceAspect.Metadata); MockCore.Management.AddMediaItemAspectStorage(ImporterAspect.Metadata); MockCore.Management.AddMediaItemAspectStorage(MediaAspect.Metadata); IList <MediaItemAspect> aspects = new List <MediaItemAspect>(); SingleMediaItemAspect aspect1 = new SingleMediaItemAspect(mia1.Metadata); aspect1.SetAttribute(mia1.ATTR_INTEGER, 1); aspect1.SetAttribute(mia1.ATTR_STRING, "one"); aspects.Add(aspect1); MultipleMediaItemAspect aspect2_1 = new MultipleMediaItemAspect(mia2.Metadata); aspect2_1.SetAttribute(mia2.ATTR_ID, "2_1"); aspect2_1.SetAttribute(mia2.ATTR_STRING, "two.one"); aspects.Add(aspect2_1); MultipleMediaItemAspect aspect2_2 = new MultipleMediaItemAspect(mia2.Metadata); aspect2_2.SetAttribute(mia2.ATTR_ID, "2_2"); aspect2_2.SetAttribute(mia2.ATTR_STRING, "two.two"); aspects.Add(aspect2_2); MultipleMediaItemAspect aspect3_1 = new MultipleMediaItemAspect(mia3.Metadata); aspect3_1.SetAttribute(mia3.ATTR_ID, "3_1"); aspect3_1.SetAttribute(mia3.ATTR_INTEGER, 31); aspects.Add(aspect3_1); MultipleMediaItemAspect aspect3_2 = new MultipleMediaItemAspect(mia3.Metadata); aspect3_2.SetAttribute(mia3.ATTR_ID, "3_2"); aspect3_2.SetAttribute(mia3.ATTR_INTEGER, 32); aspects.Add(aspect3_2); MultipleMediaItemAspect aspect3_3 = new MultipleMediaItemAspect(mia3.Metadata); aspect3_3.Deleted = true; aspect3_3.SetAttribute(mia3.ATTR_INTEGER, 33); aspects.Add(aspect3_3); Guid itemId = new Guid("aaaaaaaa-1111-1111-1111-aaaaaaaaaaaa"); MockReader resourceReader = MockDBUtils.AddReader(1, "SELECT MEDIA_ITEM_ID FROM M_PROVIDERRESOURCE WHERE SYSTEM_ID = @SYSTEM_ID AND PATH = @PATH", "MEDIA_ITEM_ID"); resourceReader.AddResult(itemId); DateTime importDate; DateTime.TryParse("2014-10-11 12:34:56", out importDate); MockReader importReader = MockDBUtils.AddReader(2, "SELECT LASTIMPORTDATE A0, DIRTY A1, DATEADDED A2 FROM M_IMPORTEDITEM WHERE MEDIA_ITEM_ID = @MEDIA_ITEM_ID", "A0", "A1", "A2"); importReader.AddResult(importDate, "false", importDate); string pathStr = @"c:\item.mp3"; MockReader mraReader = MockDBUtils.AddReader(3, "SELECT SYSTEM_ID A0, RESOURCEINDEX A1, ISPRIMARY A2, MIMETYPE A3, SIZE A4, PATH A5, PARENTDIRECTORY A6 FROM M_PROVIDERRESOURCE WHERE MEDIA_ITEM_ID = @MEDIA_ITEM_ID", "MEDIA_ITEM_ID"); mraReader.AddResult("00000000-0000-0000-0000-000000000000", 0, true, "audio/mp3", 100, pathStr, Guid.Empty); MockReader mia1Reader = MockDBUtils.AddReader(4, "SELECT MEDIA_ITEM_ID FROM M_SINGLE1 WHERE MEDIA_ITEM_ID = @MEDIA_ITEM_ID", "MEDIA_ITEM_ID"); mia1Reader.AddResult(itemId); MockReader mia2Reader1 = MockDBUtils.AddReader(5, "SELECT MEDIA_ITEM_ID FROM M_MULTIPLE2 WHERE MEDIA_ITEM_ID = @MEDIA_ITEM_ID AND ATTR_ID = @ATTR_ID", "MEDIA_ITEM_ID", "ATTR_ID"); mia2Reader1.AddResult(itemId, "1_1"); MockReader mia2Reader2 = MockDBUtils.AddReader(6, "SELECT MEDIA_ITEM_ID FROM M_MULTIPLE2 WHERE MEDIA_ITEM_ID = @MEDIA_ITEM_ID AND ATTR_ID = @ATTR_ID", "MEDIA_ITEM_ID", "ATTR_ID"); mia2Reader2.AddResult(itemId, "1_1"); MockDBUtils.AddReader(7, "SELECT MEDIA_ITEM_ID FROM M_MULTIPLE2 WHERE MEDIA_ITEM_ID = @MEDIA_ITEM_ID AND ATTR_ID = @ATTR_ID", "MEDIA_ITEM_ID", "ATTR_ID"); MockDBUtils.AddReader(8, "SELECT MEDIA_ITEM_ID FROM M_MULTIPLE2 WHERE MEDIA_ITEM_ID = @MEDIA_ITEM_ID AND ATTR_ID = @ATTR_ID", "MEDIA_ITEM_ID", "ATTR_ID"); MockDBUtils.AddReader(9, "SELECT MEDIA_ITEM_ID FROM M_MULTIPLE3 WHERE MEDIA_ITEM_ID = @MEDIA_ITEM_ID AND ATTR_ID = @ATTR_ID", "MEDIA_ITEM_ID", "ATTR_ID"); MockDBUtils.AddReader(10, "SELECT MEDIA_ITEM_ID FROM M_MULTIPLE3 WHERE MEDIA_ITEM_ID = @MEDIA_ITEM_ID AND ATTR_ID = @ATTR_ID", "MEDIA_ITEM_ID", "ATTR_ID"); MockDBUtils.AddReader(11, "SELECT T7.MEDIA_ITEM_ID A26, T0.MEDIA_ITEM_ID A27, T1.MEDIA_ITEM_ID A28, T2.MEDIA_ITEM_ID A29, T3.MEDIA_ITEM_ID A30, T4.MEDIA_ITEM_ID A31, " + "T5.MEDIA_ITEM_ID A32, T6.MEDIA_ITEM_ID A33, T0.ATTR_STRING A0, T0.ATTR_INTEGER A1, T1.ATTR_ID A2, T1.ATTR_STRING A3, T2.ATTR_ID A4, T2.ATTR_INTEGER A5, T3.ATTR_STRING A6, " + "T3.ATTR_INTEGER A7, T4.SYSTEM_ID A8, T4.RESOURCEINDEX A9, T4.ISPRIMARY A10, T4.MIMETYPE A11, T4.SIZE A12, T4.PATH A13, T4.PARENTDIRECTORY A14, T5.LASTIMPORTDATE A15, T5.DIRTY A16, " + "T5.DATEADDED A17, T6.TITLE A18, T6.SORTTITLE A19, T6.RECORDINGTIME A20, T6.RATING A21, T6.COMMENT A22, T6.PLAYCOUNT A23, T6.LASTPLAYED A24, T6.ISVIRTUAL A25 FROM MEDIA_ITEMS T7 " + "LEFT OUTER JOIN M_SINGLE1 T0 ON T0.MEDIA_ITEM_ID = T7.MEDIA_ITEM_ID LEFT OUTER JOIN M_MULTIPLE2 T1 ON T1.MEDIA_ITEM_ID = T7.MEDIA_ITEM_ID " + "LEFT OUTER JOIN M_MULTIPLE3 T2 ON T2.MEDIA_ITEM_ID = T7.MEDIA_ITEM_ID LEFT OUTER JOIN M_SINGLE4 T3 ON T3.MEDIA_ITEM_ID = T7.MEDIA_ITEM_ID " + "LEFT OUTER JOIN M_PROVIDERRESOURCE T4 ON T4.MEDIA_ITEM_ID = T7.MEDIA_ITEM_ID LEFT OUTER JOIN M_IMPORTEDITEM T5 ON T5.MEDIA_ITEM_ID = T7.MEDIA_ITEM_ID " + "LEFT OUTER JOIN M_MEDIAITEM T6 ON T6.MEDIA_ITEM_ID = T7.MEDIA_ITEM_ID WHERE T7.MEDIA_ITEM_ID = @V0", "V0"); ResourcePath path = LocalFsResourceProviderBase.ToResourcePath(pathStr); MockCore.Library.AddOrUpdateMediaItem(Guid.Empty, null, path, aspects, true); MockCore.ShutdownLibrary(); }
public void TestEditSmallMediaItem() { MockDBUtils.Reset(); MockCore.SetupLibrary(); MultipleTestMIA mia1 = TestCommonUtils.CreateMultipleMIA("MULTIPLE1", Cardinality.Inline, true, false); MockCore.Management.AddMediaItemAspectStorage(mia1.Metadata); MockCore.Management.AddMediaItemAspectStorage(ProviderResourceAspect.Metadata); MockCore.Management.AddMediaItemAspectStorage(ImporterAspect.Metadata); MockCore.Management.AddMediaItemAspectStorage(MediaAspect.Metadata); IList <MediaItemAspect> aspects = new List <MediaItemAspect>(); MultipleMediaItemAspect aspect1_1 = new MultipleMediaItemAspect(mia1.Metadata); aspect1_1.SetAttribute(mia1.ATTR_STRING, "1_1"); aspect1_1.SetAttribute(mia1.ATTR_STRING, "one.three"); aspects.Add(aspect1_1); MultipleMediaItemAspect aspect1_2 = new MultipleMediaItemAspect(mia1.Metadata); aspect1_2.SetAttribute(mia1.ATTR_STRING, "1_2"); aspect1_2.SetAttribute(mia1.ATTR_STRING, "one.two"); aspects.Add(aspect1_2); Guid itemId = new Guid("aaaaaaaa-1111-1111-1111-aaaaaaaaaaaa"); MockReader resourceReader = MockDBUtils.AddReader(1, "SELECT MEDIA_ITEM_ID FROM M_PROVIDERRESOURCE WHERE SYSTEM_ID = @SYSTEM_ID AND PATH = @PATH", "MEDIA_ITEM_ID"); resourceReader.AddResult(itemId); DateTime importDate; DateTime.TryParse("2014-10-11 12:34:56", out importDate); MockReader importReader = MockDBUtils.AddReader(2, "SELECT LASTIMPORTDATE A0, DIRTY A1, DATEADDED A2 FROM M_IMPORTEDITEM WHERE MEDIA_ITEM_ID = @MEDIA_ITEM_ID", "A0", "A1", "A2"); importReader.AddResult(importDate, "false", importDate); string pathStr = @"c:\item.mp3"; MockReader mraReader = MockDBUtils.AddReader(3, "SELECT SYSTEM_ID A0, RESOURCEINDEX A1, ISPRIMARY A2, MIMETYPE A3, SIZE A4, PATH A5, PARENTDIRECTORY A6 FROM M_PROVIDERRESOURCE WHERE MEDIA_ITEM_ID = @MEDIA_ITEM_ID", "MEDIA_ITEM_ID"); mraReader.AddResult(null, 0, true, "audio/mp3", 100, pathStr, Guid.Empty); MockReader mia1Reader1 = MockDBUtils.AddReader(4, "SELECT MEDIA_ITEM_ID FROM M_MULTIPLE1 WHERE MEDIA_ITEM_ID = @MEDIA_ITEM_ID AND ATTR_ID = @ATTR_ID", "MEDIA_ITEM_ID", "ATTR_ID"); mia1Reader1.AddResult(itemId, "1_1"); MockReader mia1Reader2 = MockDBUtils.AddReader(5, "SELECT MEDIA_ITEM_ID FROM M_MULTIPLE1 WHERE MEDIA_ITEM_ID = @MEDIA_ITEM_ID AND ATTR_ID = @ATTR_ID", "MEDIA_ITEM_ID", "ATTR_ID"); mia1Reader2.AddResult(itemId, "1_1"); MockDBUtils.AddReader(6, "SELECT T4.MEDIA_ITEM_ID A20, T0.MEDIA_ITEM_ID A21, T1.MEDIA_ITEM_ID A22, T2.MEDIA_ITEM_ID A23, T3.MEDIA_ITEM_ID A24, T0.ATTR_ID A0, T0.ATTR_STRING A1, T1.SYSTEM_ID A2, " + "T1.RESOURCEINDEX A3, T1.ISPRIMARY A4, T1.MIMETYPE A5, T1.SIZE A6, T1.PATH A7, T1.PARENTDIRECTORY A8, T2.LASTIMPORTDATE A9, T2.DIRTY A10, T2.DATEADDED A11, T3.TITLE A12, T3.SORTTITLE A13, T3.RECORDINGTIME A14, " + "T3.RATING A15, T3.COMMENT A16, T3.PLAYCOUNT A17, T3.LASTPLAYED A18, T3.ISVIRTUAL A19 FROM MEDIA_ITEMS T4 LEFT OUTER JOIN M_MULTIPLE1 T0 ON T0.MEDIA_ITEM_ID = T4.MEDIA_ITEM_ID " + "LEFT OUTER JOIN M_PROVIDERRESOURCE T1 ON T1.MEDIA_ITEM_ID = T4.MEDIA_ITEM_ID LEFT OUTER JOIN M_IMPORTEDITEM T2 ON T2.MEDIA_ITEM_ID = T4.MEDIA_ITEM_ID " + "LEFT OUTER JOIN M_MEDIAITEM T3 ON T3.MEDIA_ITEM_ID = T4.MEDIA_ITEM_ID WHERE T4.MEDIA_ITEM_ID = @V0", "V0"); ResourcePath path = LocalFsResourceProviderBase.ToResourcePath(pathStr); MockCore.Library.AddOrUpdateMediaItem(Guid.Empty, null, path, aspects, true); MockCore.ShutdownLibrary(); }
public void TestAddMediaItem() { MockDBUtils.Reset(); MockCore.SetupLibrary(); SingleTestMIA mia1 = TestCommonUtils.CreateSingleMIA("SINGLE1", Cardinality.Inline, true, true); MultipleTestMIA mia2 = TestCommonUtils.CreateMultipleMIA("MULTIPLE2", Cardinality.Inline, true, false); MultipleTestMIA mia3 = TestCommonUtils.CreateMultipleMIA("MULTIPLE3", Cardinality.Inline, false, true); MockCore.Management.AddMediaItemAspectStorage(mia1.Metadata); MockCore.Management.AddMediaItemAspectStorage(mia2.Metadata); MockCore.Management.AddMediaItemAspectStorage(mia3.Metadata); MockCore.Management.AddMediaItemAspectStorage(ProviderResourceAspect.Metadata); MockCore.Management.AddMediaItemAspectStorage(ImporterAspect.Metadata); MockCore.Management.AddMediaItemAspectStorage(MediaAspect.Metadata); IList <MediaItemAspect> aspects = new List <MediaItemAspect>(); SingleMediaItemAspect aspect1 = new SingleMediaItemAspect(mia1.Metadata); aspect1.SetAttribute(mia1.ATTR_INTEGER, 1); aspect1.SetAttribute(mia1.ATTR_STRING, "one"); aspects.Add(aspect1); MultipleMediaItemAspect aspect2_1 = new MultipleMediaItemAspect(mia2.Metadata); aspect2_1.SetAttribute(mia2.ATTR_STRING, "two.one"); aspects.Add(aspect2_1); MultipleMediaItemAspect aspect2_2 = new MultipleMediaItemAspect(mia2.Metadata); aspect2_2.SetAttribute(mia2.ATTR_STRING, "two.two"); aspects.Add(aspect2_2); MultipleMediaItemAspect aspect3_1 = new MultipleMediaItemAspect(mia3.Metadata); aspect3_1.SetAttribute(mia3.ATTR_INTEGER, 31); aspects.Add(aspect3_1); MultipleMediaItemAspect aspect3_2 = new MultipleMediaItemAspect(mia3.Metadata); aspect3_2.SetAttribute(mia3.ATTR_INTEGER, 32); aspects.Add(aspect3_2); MultipleMediaItemAspect aspect3_3 = new MultipleMediaItemAspect(mia3.Metadata); aspect3_3.SetAttribute(mia3.ATTR_INTEGER, 33); aspects.Add(aspect3_3); MockDBUtils.AddReader(1, "SELECT MEDIA_ITEM_ID FROM M_PROVIDERRESOURCE WHERE SYSTEM_ID = @SYSTEM_ID AND PATH = @PATH", "MEDIA_ITEM_ID"); MockDBUtils.AddReader(2, "SELECT T6.MEDIA_ITEM_ID A24, T0.MEDIA_ITEM_ID A25, T1.MEDIA_ITEM_ID A26, T2.MEDIA_ITEM_ID A27, T3.MEDIA_ITEM_ID A28, " + "T4.MEDIA_ITEM_ID A29, T5.MEDIA_ITEM_ID A30, T0.ATTR_STRING A0, T0.ATTR_INTEGER A1, T1.ATTR_ID A2, T1.ATTR_STRING A3, T2.ATTR_ID A4, T2.ATTR_INTEGER A5, " + "T3.SYSTEM_ID A6, T3.RESOURCEINDEX A7, T3.ISPRIMARY A8, T3.MIMETYPE A9, T3.SIZE A10, T3.PATH A11, T3.PARENTDIRECTORY A12, T4.LASTIMPORTDATE A13, T4.DIRTY A14, " + "T4.DATEADDED A15, T5.TITLE A16, T5.SORTTITLE A17, T5.RECORDINGTIME A18, T5.RATING A19, T5.COMMENT A20, T5.PLAYCOUNT A21, T5.LASTPLAYED A22, T5.ISVIRTUAL A23 " + "FROM MEDIA_ITEMS T6 LEFT OUTER JOIN M_SINGLE1 T0 ON T0.MEDIA_ITEM_ID = T6.MEDIA_ITEM_ID LEFT OUTER JOIN M_MULTIPLE2 T1 ON T1.MEDIA_ITEM_ID = T6.MEDIA_ITEM_ID " + "LEFT OUTER JOIN M_MULTIPLE3 T2 ON T2.MEDIA_ITEM_ID = T6.MEDIA_ITEM_ID LEFT OUTER JOIN M_PROVIDERRESOURCE T3 ON T3.MEDIA_ITEM_ID = T6.MEDIA_ITEM_ID " + "LEFT OUTER JOIN M_IMPORTEDITEM T4 ON T4.MEDIA_ITEM_ID = T6.MEDIA_ITEM_ID LEFT OUTER JOIN M_MEDIAITEM T5 ON T5.MEDIA_ITEM_ID = T6.MEDIA_ITEM_ID WHERE T6.MEDIA_ITEM_ID = @V0", "V0"); string pathStr = "c:\\item.mp3"; ResourcePath path = LocalFsResourceProviderBase.ToResourcePath(pathStr); MockCore.Library.AddOrUpdateMediaItem(Guid.Empty, null, path, aspects, false); MockCore.ShutdownLibrary(); }