Exemplo n.º 1
0
        public async Task NotSupportedAsync()
        {
            var setting = new CsvFile(UnitTestInitializeCsv.GetTestPath("Emp.json"))
            {
                JsonFormat = true
            };

            using (var dpd = new CustomProcessDisplay(UnitTestInitializeCsv.Token))
                using (var jfr = new JsonFileReader(setting, dpd))
                {
                    await jfr.OpenAsync(dpd.CancellationToken);

                    await jfr.ReadAsync(dpd.CancellationToken);

                    try
                    {
                        var buffer = new byte[200];
                        jfr.GetBytes(1, 0, buffer, 0, 100);
                        Assert.Fail("GetBytes - No Exception");
                    }
                    catch (NotImplementedException)
                    {
                    }
                    catch (Exception ex)
                    {
                        Assert.Fail($"GetBytes - Wrong type of exception  {ex.GetType().Name}");
                    }

                    try
                    {
                        var buffer = new byte[200];
                        jfr.GetBytes(1, 0, buffer, 0, 100);
                        Assert.Fail("No Exception");
                    }
                    catch (NotImplementedException)
                    {
                    }
                    catch (Exception ex)
                    {
                        Assert.Fail($"Wrong type of exception  {ex.GetType().Name}");
                    }

                    try
                    {
                        var buffer = new byte[200];
                        jfr.GetBytes(1, 0, buffer, 0, 100);
                        Assert.Fail("No Exception");
                    }
                    catch (NotImplementedException)
                    {
                    }
                    catch (Exception ex)
                    {
                        Assert.Fail($"Wrong type of exception  {ex.GetType().Name}");
                    }

                    try
                    {
                        jfr.GetData(2);
                        Assert.Fail("GetData - No Exception");
                    }
                    catch (NotImplementedException)
                    {
                    }
                    catch (Exception ex)
                    {
                        Assert.Fail($"GetData - Wrong type of exception  {ex.GetType().Name}");
                    }
                }
        }