Пример #1
0
        public void ByteViewer_SaveToFile_InvokeWithBytes_Success()
        {
            using var control = new ByteViewer();
            control.SetBytes(new byte[] { 1, 2, 3 });
            string path = "ByteViewerContent";

            try
            {
                control.SaveToFile(path);
                Assert.Equal(new byte[] { 1, 2, 3 }, File.ReadAllBytes(path));
            }
            finally
            {
                File.Delete(path);
            }
        }
Пример #2
0
 public void ByteViewer_SaveToFile_InvokeInvalidPath_ThrowsArgumentException(string path)
 {
     using var control = new ByteViewer();
     control.SetBytes(Array.Empty <byte>());
     Assert.Throws <ArgumentException>("path", () => control.SaveToFile(path));
 }
Пример #3
0
 public void ByteViewer_SaveToFile_InvokeNullPath_ThrowsArgumentNullException()
 {
     using var control = new ByteViewer();
     control.SetBytes(Array.Empty <byte>());
     Assert.Throws <ArgumentNullException>("path", () => control.SaveToFile(null));
 }
Пример #4
0
 public void ByteViewer_SaveToFile_InvokeNoBytes_Nop(string path)
 {
     using var control = new ByteViewer();
     control.SaveToFile(path);
 }