public void CreateUpdateDeleteFilterWithAllSelectStatements() { string filterName = "CreateUpdateDeleteFilter_" + Guid.NewGuid().ToString(); List <FilterTrackSelectStatement> filterTrackSelectStatements = new List <FilterTrackSelectStatement>(); FilterTrackSelectStatement filterTrackSelectStatement = new FilterTrackSelectStatement(); filterTrackSelectStatement.PropertyConditions = new List <IFilterTrackPropertyCondition>(); filterTrackSelectStatement.PropertyConditions.Add(new FilterTrackNameCondition("Track Name", FilterTrackCompareOperator.NotEqual)); filterTrackSelectStatement.PropertyConditions.Add(new FilterTrackFourCCCondition("AACL", FilterTrackCompareOperator.NotEqual)); filterTrackSelectStatement.PropertyConditions.Add(new FilterTrackBitrateRangeCondition(new FilterTrackBitrateRange(0, 1), FilterTrackCompareOperator.NotEqual)); filterTrackSelectStatement.PropertyConditions.Add(new FilterTrackLanguageCondition("ru", FilterTrackCompareOperator.NotEqual)); filterTrackSelectStatement.PropertyConditions.Add(new FilterTrackTypeCondition(FilterTrackType.Text, FilterTrackCompareOperator.NotEqual)); filterTrackSelectStatements.Add(filterTrackSelectStatement); IStreamingFilter filter = _mediaContext.Filters.Create(filterName, new PresentationTimeRange(), filterTrackSelectStatements); Assert.IsNotNull(filter); Assert.AreEqual(1, _mediaContext.Filters.Where(c => c.Name == filter.Name).Count()); Assert.AreNotEqual(0, _mediaContext.Filters.Count()); Assert.AreEqual(5, _mediaContext.Filters.Where(c => c.Name == filter.Name).First().Tracks.First().PropertyConditions.Count); filter.PresentationTimeRange = new PresentationTimeRange(timescale: 500); filter.Update(); Assert.AreEqual(5, _mediaContext.Filters.Where(c => c.Name == filter.Name).First().Tracks.First().PropertyConditions.Count); Assert.IsNotNull(_mediaContext.Filters.Where(c => c.Name == filter.Name).FirstOrDefault()); filter.Delete(); Assert.IsNull(_mediaContext.Filters.Where(c => c.Name == filter.Name).FirstOrDefault()); }
public void AssetFilterCRUD() { IStreamingFilter filter = _mediaContext.Filters.Create("UniTest", new PresentationTimeRange(), new List <FilterTrackSelectStatement>()); Assert.IsNotNull(filter); Assert.IsNotNull(filter.Tracks); filter.Delete(); Assert.IsNull(_mediaContext.Assets.Where(c => c.Name == filter.Name).FirstOrDefault()); }
public void CreateUpdateDeleteFilterWithDefaultPresentationTimeRangeAndEmptyFilterTrackSelectStatement() { string filterName = "CreateUpdateDeleteFilter_" + Guid.NewGuid().ToString(); IStreamingFilter filter = _mediaContext.Filters.Create(filterName, new PresentationTimeRange(), new List <FilterTrackSelectStatement>()); Assert.IsNotNull(filter); Assert.AreEqual(1, _mediaContext.Filters.Where(c => c.Name == filter.Name).Count()); Assert.AreNotEqual(0, _mediaContext.Filters.Count()); filter.PresentationTimeRange = new PresentationTimeRange(timescale: 500); filter.Update(); Assert.IsNotNull(_mediaContext.Filters.Where(c => c.Name == filter.Name).FirstOrDefault()); filter.Delete(); Assert.IsNull(_mediaContext.Filters.Where(c => c.Name == filter.Name).FirstOrDefault()); }