public void ProcessFrxTestTotalImages2() { // Arrange FrxReader frxReader = new FrxReader(); frxReader.FrxFile = new byte[] { 0x00, 0x00, 0x00, 0x00, //dummy bytes 0x55, 0x53, 0x74, 0x79, 0x6c, 0x65, 0x01, 0x05, // indicator of start 0x02, 0x00, 0x00, 0x00, // Total of images to read 0x01, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x28, 0x00, // first image 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC8, 0xD0, 0xD4, 0xC8, 0xD0, 0xD4, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // dummy bytes 0x01, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x28, 0x00, // second image 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC8, 0xD0, 0xD4, 0xC8, 0xD0, 0xD4, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // dummies 0x90, 0xd0, 0x03, 0x00, 0x3a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Grid Name start 0x05, 0x00, 0x00, 0x00, 0x47, 0x72, 0x69, 0x64, 0x00 // "Grid" }; int expectedResult = 2; // Act frxReader.ProcessFrx(); int actualResult = frxReader.TotalImages; // Assert Assert.AreEqual(expectedResult, actualResult); }
public void ProcessImagesBatchTotalImages() { // Arrange FrxReader frxReader = new FrxReader(); frxReader.FrxFile = new byte[] { 0x00, 0x00, 0x00, 0x00, //dummy bytes 0x55, 0x53, 0x74, 0x79, 0x6c, 0x65, 0x01, 0x05, // indicator of start 0x02, 0x00, 0x00, 0x00, // Total of images to read 0x01, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x28, 0x00, // first image 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC8, 0xD0, 0xD4, 0xC8, 0xD0, 0xD4, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // dummy bytes 0x01, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x28, 0x00, // second image 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC8, 0xD0, 0xD4, 0xC8, 0xD0, 0xD4, 0x00, 0x00, }; int expectedResult = 2; // Act frxReader.MoveIndexNextStartStylesImage(); int actualResult = frxReader.ProcessImagesBatch().Count; // Assert Assert.AreEqual(expectedResult, actualResult); }
public void TotalGridWithImagesTestDefaultValue() { //Arrange FrxReader frxReader = new FrxReader(); int expectedResult = 0; //Act int actualResult = frxReader.TotalGridWithImages; //Assert Assert.AreEqual(expectedResult, actualResult); }
public void ReaderIndexTestDefaultValue() { //Arrange FrxReader frxReader = new FrxReader(); int expectedResult = 0; //Act int actualResult = frxReader.ReaderIndex; //Assert Assert.AreEqual(expectedResult, actualResult); }
public void ReaderIndexTestSetAndGet() { //Arrange FrxReader frxReader = new FrxReader(); frxReader.ReaderIndex = 231; int expectedResult = 231; //Act int actualResult = frxReader.ReaderIndex; //Assert Assert.AreEqual(expectedResult, actualResult); }
public void TotalGridWithImagesTestSetAndGet() { //Arrange FrxReader frxReader = new FrxReader(); frxReader.TotalGridWithImages = 3; int expectedResult = 3; //Act int actualResult = frxReader.TotalGridWithImages; //Assert Assert.AreEqual(expectedResult, actualResult); }
public void FilePathTestSetAndGet() { //Arrange FrxReader frxReader = new FrxReader(); string expectedResult = @"C:\Users\JohnDoe\Desktop\forms"; frxReader.FrxFilePath = @"C:\Users\JohnDoe\Desktop\forms"; //Act string actualResult = frxReader.FrxFilePath; //Assert Assert.AreEqual(expectedResult, actualResult); }
public void MoveIndexNextStartStylesImageTest() { // Arrange FrxReader frxReader = new FrxReader(); frxReader.FrxFile = new byte[] { 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, 0x55, 0x53, 0x74, 0x79, 0x6c, 0x65, 0x01, 0x05, 0x01, 0x00, 0x00, 0x00 }; int expectedResult = 14; // Act frxReader.MoveIndexNextStartStylesImage(); int actualResult = frxReader.ReaderIndex; // Assert Assert.AreEqual(expectedResult, actualResult); }
public void FrxFileSetAndGet() { //Arrange FrxReader frxReader = new FrxReader(); frxReader.FrxFile = new byte[] { 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F }; byte[] expectedResult = { 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F }; //Act byte[] actualResult = frxReader.FrxFile; bool areEqual = expectedResult.SequenceEqual(actualResult); // Assert Assert.IsTrue(areEqual); }
public void ReadBytesTestBytes() { // Arrange FrxReader frxReader = new FrxReader(); frxReader.FrxFile = new byte[] { 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, 0x55, 0x53, 0x74, 0x79, 0x6c, 0x65, 0x01, 0x05, 0x01, 0x00, 0x00, 0x00 }; frxReader.ReaderIndex = 4; byte[] expectedResult = { 0x0E, 0x0F, 0x55, 0x53 }; // Act byte[] actualResult = frxReader.ReadBytes(4); bool areEqual = expectedResult.SequenceEqual(actualResult); // Assert Assert.IsTrue(areEqual); }
public void ReadBytesTestIndex() { // Arrange FrxReader frxReader = new FrxReader(); frxReader.FrxFile = new byte[] { 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, 0x55, 0x53, 0x74, 0x79, 0x6c, 0x65, 0x01, 0x05, 0x01, 0x00, 0x00, 0x00 }; frxReader.ReaderIndex = 4; int expectedResult = 8; // Act frxReader.ReadBytes(4); int actualResult = frxReader.ReaderIndex; // Assert Assert.AreEqual(expectedResult, actualResult); }
public void ProcessGridNameTest() { // Arrange FrxReader frxReader = new FrxReader(); frxReader.FrxFile = new byte[] { 0x00, 0x00, 0x00, 0x00, // dummies 0x90, 0xd0, 0x03, 0x00, 0x3a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Grid Name start 0x05, 0x00, 0x00, 0x00, 0x47, 0x72, 0x69, 0x64, 0x00 // "Grid" }; string expectedResult = "Grid"; // Act frxReader.MoveIndexNextStartGridName(); string actualResult = frxReader.ProcessGridName(); // Assert Assert.AreEqual(expectedResult, actualResult); }
public void ProcessImageBytesTestDataSize() { // Arrange FrxReader frxReader = new FrxReader(); frxReader.FrxFile = new byte[] { 0x01, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC8, 0xD0, 0xD4, 0xC8, 0xD0, 0xD4, 0x00, 0x00 }; int expectedResult = 56; // Act Image img = frxReader.ProcessImageBytes(); int actualResult = img.DataSize; // Assert Assert.AreEqual(expectedResult, actualResult); }
public void ReadNamedStyleInfoTest() { // Arrange FrxReader frxReader = new FrxReader(); frxReader.FrxFile = new byte[] { 0x4E, 0x6F, 0x72, 0x6D, 0x61, 0x6C, 0x00, 0x06, 0x11, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x1C, 0xDE, 0xFB, 0x04, 0x60, 0x0C, 0xAA, 0x06, 0x00, 0x0B, 0x00, 0x00, 0x41, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; TrueDBGrid grid = new TrueDBGrid(); grid.AllStyles = new Style[]{ new Style() }; // Act frxReader.ReadNamedStyleInfo(grid, 1); NamedStyle namedStyle = grid.NamedStyles[0]; bool actualResult = namedStyle.Name == "Normal" && namedStyle.Index == 1; // Assert Assert.IsTrue(actualResult); }
public void ReadStyleAssignmentInfoTest() { // Arrange FrxReader frxReader = new FrxReader(); frxReader.FrxFile = new byte[] { 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00 }; // Act StyleAssignment styleAssignment = frxReader.ReadStyleAssignmentInfo("CaptionStyle"); bool actualResult = styleAssignment.StyleIndex == 2 && styleAssignment.SplitIndex == 3 && styleAssignment.DisplayColumnIndex == 4 && styleAssignment.NamedStyleIndex == 5; // Assert Assert.IsTrue(actualResult); }
public void ReadStyleBytesTest() { // Arrange FrxReader frxReader = new FrxReader(); frxReader.FrxFile = new byte[] { 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0xFF, 0x09, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x80, 0x08, 0x00, 0x00, 0x80, 0x39, 0x03, 0x00, 0x00, 0x4D, 0x53, 0x20, 0x53, 0x61, 0x6E, 0x73, 0x20, 0x53, 0x65, 0x72, 0x69, 0x66, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00 }; // Act Style style = frxReader.ProcessStyleBytes(); bool actualResult = style.Index == 2 && style.ParentIndex == 1 && style.FontName == "MS Sans Serif" && style.ForegroundPictureIndex == 3 && style.BackgroundPictureIndex == -1; // Assert Assert.IsTrue(actualResult); }
public void ProcessImageBytesTestData() { // Arrange FrxReader frxReader = new FrxReader(); frxReader.FrxFile = new byte[] { 0x01, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC8, 0xD0, 0xD4, 0xC8, 0xD0, 0xD4, 0x00, 0x00 }; byte[] expectedResult = {0x28, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC8, 0xD0, 0xD4, 0xC8, 0xD0, 0xD4, 0x00, 0x00 }; // Act Image img = frxReader.ProcessImageBytes(); byte[] actualResult = img.Data; // Assert bool areEqual = expectedResult.SequenceEqual(actualResult); Assert.IsTrue(areEqual); }