public void TablatureAttributesDataCheckTestMethod() { ITablatureRepository _repository; TablatureService _service; TablatureModel tab; try { _repository = new TablatureRepository(_fileDirectory); Assert.IsNotNull(_repository); _service = new TablatureService(_repository); Assert.IsNotNull(_service); foreach (Guid witnessId in _WITNESS_TAB_IDS) { tab = _service.Get(witnessId); Assert.IsNotNull(tab); Assert.AreNotEqual <Guid>(Guid.Empty, tab.Id); tab = null; } } catch (Exception ex) { Assert.Fail(ex.Message, ex); } finally { _repository = null; _service = null; tab = null; } }
public void TabPropertiesTestMethod() { ITablatureRepository _repository; IEnumerable <TablatureProperty> _tabProperties; try { _repository = new TablatureRepository(_fileDirectory); Assert.IsNotNull(_repository); foreach (Guid witnessTabId in _GUITAR_WITNESS_TAB_IDS) { _tabProperties = _repository.ListTablatureProperties(witnessTabId); Assert.IsNotNull(_tabProperties); Assert.IsFalse(_tabProperties.Count() == 0); Assert.IsNotNull(_tabProperties.Where(x => x.Code == (int)TablaturePropertyEnum.SongName).Select(x => x.Value).FirstOrDefault()); Assert.IsNotNull(_tabProperties.Where(x => x.Code == (int)TablaturePropertyEnum.Artist).Select(x => x.Value).FirstOrDefault()); Assert.IsNotNull(_tabProperties.Where(x => x.Code == (int)TablaturePropertyEnum.Identifier).Select(x => x.Value).FirstOrDefault()); Assert.AreEqual <Guid>(witnessTabId, new Guid(_tabProperties.Where(x => x.Code == (int)TablaturePropertyEnum.Identifier).Select(x => x.Value).First())); } } catch (Exception ex) { Assert.Fail(ex.Message); } finally { _tabProperties = null; _repository = null; } }
public void GetTabStorageFormatVersionTestMethod() { ITablatureRepository _repository; StorageFormatVersion sfv; try { _repository = new TablatureRepository(_fileDirectory); Assert.IsNotNull(_repository); foreach (Guid witnessTabId in _GUITAR_WITNESS_TAB_IDS) { sfv = null; sfv = _repository.GetTablatureStorageFormatVersion(witnessTabId); Assert.IsNotNull(sfv); Assert.IsTrue(sfv.Minor > 0); } } catch (Exception ex) { Assert.Fail(ex.Message); } finally { sfv = null; _repository = null; } }
public void TabSectionImplementationsTestMethod() { ITablatureRepository _repository; IEnumerable <SectionDeclaration> _tabSectionDeclarations; IEnumerable <SectionImplementation> sectionImplementations; try { _repository = new TablatureRepository(_fileDirectory); foreach (Guid witnessTabId in _GUITAR_WITNESS_TAB_IDS) { _tabSectionDeclarations = _repository.ListSectionDeclarations(witnessTabId); sectionImplementations = _repository.ListSectionImplementations(witnessTabId, _tabSectionDeclarations); Assert.IsNotNull(sectionImplementations); Assert.IsFalse(sectionImplementations.Count() == 0); } } catch (Exception ex) { Assert.Fail(ex.Message); } finally { _repository = null; sectionImplementations = null; } }
public void TabSectionDeclarationsTestMethod() { ITablatureRepository _repository; IEnumerable <SectionDeclaration> _tabSectionDeclarations; try { _repository = new TablatureRepository(_fileDirectory); Assert.IsNotNull(_repository); foreach (Guid witnessTabId in _GUITAR_WITNESS_TAB_IDS) { _tabSectionDeclarations = _repository.ListSectionDeclarations(witnessTabId); Assert.IsNotNull(_tabSectionDeclarations); Assert.IsFalse(_tabSectionDeclarations.Count() == 0); // Check that unique sections have not duplicates declarations if (_tabSectionDeclarations.Where(x => x.Type == (int)SectionDeclarationTypeEnum.SongStructure).Count() > 1) { Assert.Fail("multiple song structure section declarations"); } else if (_tabSectionDeclarations.Where(x => x.Type == (int)SectionDeclarationTypeEnum.LyricsWithChords).Count() > 1) { Assert.Fail("multiple lyrics&chords section declarations"); } // Check the coherence of the data of each section foreach (SectionDeclaration sd in _tabSectionDeclarations) { Assert.IsNotNull(sd.Type); Assert.AreNotEqual <int>(0, sd.Type); Assert.IsNotNull(sd.Id); Assert.AreNotEqual <Guid>(Guid.Empty, sd.Id); if (sd.Type == (int)SectionDeclarationTypeEnum.LanguageResource) { Assert.IsNotNull(sd.Key); Assert.AreNotEqual <string>(string.Empty, sd.Key); } } } } catch (Exception ex) { Assert.Fail(ex.Message); } finally { _tabSectionDeclarations = null; _repository = null; } }
public void TabSectionDeclarationAndImplementationsTestMethod() { ITablatureRepository _repository; IEnumerable <Guid> implementationIds; IEnumerable <SectionDeclaration> _tabSectionDeclarations; try { _repository = new TablatureRepository(_fileDirectory); foreach (Guid witnessTabId in _GUITAR_WITNESS_TAB_IDS) { // List section declaration _tabSectionDeclarations = _repository.ListSectionDeclarations(witnessTabId); // List section implementations implementationIds = _repository.ListSectionImplementationIds(witnessTabId); // Check count coherence Assert.IsNotNull(_tabSectionDeclarations); Assert.IsNotNull(implementationIds); Assert.AreNotEqual <int>(0, _tabSectionDeclarations.Count()); Assert.AreNotEqual <int>(0, implementationIds.Count()); Assert.AreEqual <int>(_tabSectionDeclarations.Count(), implementationIds.Count()); // Check ids coherence foreach (Guid sectionId in _tabSectionDeclarations.Select(x => x.Id)) { Assert.IsTrue(implementationIds.Contains(sectionId)); } } } catch (Exception ex) { Assert.Fail(ex.Message); } finally { _repository = null; implementationIds = null; _tabSectionDeclarations = null; } }