public void OnCurrentMainCriteriaChangedTest() { var projectNotesService = new ProjectNotesServiceMock(1); var metadataTypeSector = new MetadataTypeMock { Name = "Sektor" }; var metadataTypeCustomer = new MetadataTypeMock { Name = "" }; var metadataSector = new MetadataMock { Description = "Sektorkriterium" }; var metadataCustomer = new MetadataMock { Description = "Kundenkriterium" }; projectNotesService.Metadata = new Dictionary <IMetadataType, ICollection <IMetadata> > { { metadataTypeSector, new List <IMetadata> { metadataSector } }, { metadataTypeCustomer, new List <IMetadata> { metadataCustomer } } }; var target = new OverviewWindowViewModel_Accessor(projectNotesService); target.ShowSubcriteriaCommand.Execute(metadataTypeCustomer); var c = target.Maincriteria.Cast <IMetadataType>().ElementAt(0); target.OnCurrentMainCriteriaChanged(c); Assert.AreEqual(target.Subcriteria.Cast <IMetadata>().ElementAt(0).Description, metadataSector.Description); }
public void MatchTest() { var t1 = new MetadataTypeMock { Name = "Bla1" }; var t2 = new MetadataTypeMock { Name = "Bla2" }; var t3 = new MetadataTypeMock { Name = "Bla3" }; var t1M1 = Metadata.Get(t1, "Val1"); var t1M2 = Metadata.Get(t1, "Val2"); var t1M3 = Metadata.Get(t1, "Val3"); var t2M1 = Metadata.Get(t2, "Blu1"); var t2M2 = Metadata.Get(t2, "Blu2"); var t3M1 = Metadata.Get(t3, "Blbb1"); var pn = new ProjectNoteMock { Metadata = new Dictionary <IMetadataType, ICollection <IMetadata> > { { t1, new List <IMetadata> { t1M1, t1M2 } }, { t2, new List <IMetadata> { t2M1, t2M2 } }, } }; Assert.IsTrue(t1M1.Match(pn)); Assert.IsTrue(t1M2.Match(pn)); Assert.IsTrue(t2M1.Match(pn)); Assert.IsTrue(t2M2.Match(pn)); Assert.IsFalse(t1M3.Match(pn)); Assert.IsFalse(t1M3.Match(pn)); Assert.IsFalse(t3M1.Match(pn)); }