using skyscraper5; using skyscraper5.Docsis; using skyscraper5.Docsis.AnnexC; using skyscraper5.Docsis.MacManagement; using skyscraper5.Mpeg2; using skyscraper5.Skyscraper.Plugins; using skyscraper5.Skyscraper.Scraper; using skyscraper5.Skyscraper.Scraper.Storage; using skyscraper5.Skyscraper.Scraper.Storage.Filesystem; using skyscraper5.Skyscraper.Scraper.Storage.InMemory; using skyscraper8.Skyscraper.IO; using skyscraper8.Tests.ClassDependencies.DocsisTests; using skyscraper8.Tests.Properties; using System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Net.NetworkInformation; using System.Text; using System.Threading.Tasks; using Xunit.Sdk; namespace skyscraper8.Tests { public class DocsisTests { [Fact] public void ModemCapabilitiesEncoding() { byte[] buffer = Resources.ModemCapabilitiesEncodingTest; ModemCapabilitiesEncoding modemCapabilitiesEncoding = new ModemCapabilitiesEncoding(buffer); Assert.True(modemCapabilitiesEncoding.Valid); } [Fact] public void MultipartRegistrationResponse() { Random rng = new Random(); byte[] sourceBuffer = new byte[6]; rng.NextBytes(sourceBuffer); PhysicalAddress source = new PhysicalAddress(sourceBuffer); byte[] targetBuffer = new byte[6]; rng.NextBytes(targetBuffer); PhysicalAddress target = new PhysicalAddress(targetBuffer); byte[] buffer = Properties.Resources.MultipartRegistrationResponseTest; T45_V4_MultipartRegistrationResponse test = new T45_V4_MultipartRegistrationResponse(source, target, buffer); Assert.True(test.Valid); } [Fact] public void MacManagement_4_45() { DocsisEventHandlerImpl docsisEventHandler = new DocsisEventHandlerImpl(); DocsisEnvironment environment = new DocsisEnvironment(docsisEventHandler); byte[] testPayload = Resources.PushMacManagementMessage_Version4_Type45; Random rng = new Random(); byte[] sourceBuffer = new byte[6]; rng.NextBytes(sourceBuffer); PhysicalAddress source = new PhysicalAddress(sourceBuffer); byte[] targetBuffer = new byte[6]; rng.NextBytes(targetBuffer); PhysicalAddress target = new PhysicalAddress(targetBuffer); environment.PushMacManagementMessage(testPayload, 4, 45, source, target, testPayload); } [Fact] public void InvalidUpstreamChannelDescriptorTest() { byte[] testPayload = Resources.UpstreamChannelDescriptorTest; Random rng = new Random(); byte[] sourceBuffer = new byte[6]; rng.NextBytes(sourceBuffer); PhysicalAddress source = new PhysicalAddress(sourceBuffer); byte[] targetBuffer = new byte[6]; rng.NextBytes(targetBuffer); PhysicalAddress target = new PhysicalAddress(targetBuffer); UpstreamChannelDescriptor ucd = new UpstreamChannelDescriptor(source, target, testPayload); Assert.False(ucd.Valid); } [Fact] public void TransmitChannelConfigurationObjectTest() { byte[] testPayload = Resources.TransmitChannelConfigurationObject; CommonTlvEncodingObject.TransmitChannelConfigurationObject child = new CommonTlvEncodingObject.TransmitChannelConfigurationObject(testPayload); Assert.True(child.Valid); } [Fact] public void MultipartRegistrationResponse2() { Random rng = new Random(); byte[] sourceBuffer = new byte[6]; rng.NextBytes(sourceBuffer); PhysicalAddress source = new PhysicalAddress(sourceBuffer); byte[] targetBuffer = new byte[6]; rng.NextBytes(targetBuffer); PhysicalAddress target = new PhysicalAddress(targetBuffer); byte[] buffer = Properties.Resources.MultipartRegistrationResponseTest2; T45_V4_MultipartRegistrationResponse test = new T45_V4_MultipartRegistrationResponse(source, target, buffer); Assert.True(test.Valid); } } }