Skip to content

Commit

Permalink
update testst to latest api
Browse files Browse the repository at this point in the history
  • Loading branch information
beto-rodriguez committed Oct 27, 2023
1 parent fddf777 commit a442654
Showing 1 changed file with 6 additions and 50 deletions.
56 changes: 6 additions & 50 deletions tests/LiveChartsCore.UnitTesting/OtherTests/DataProviderTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -197,45 +197,7 @@ public void FetchCustomType()
var sutSeries = new ColumnSeries<City>
{
Values = new City[] { new(1), new(1), new(1), new(1), new(1) },
Mapping = (city, point) =>
{
point.Coordinate = new(point.Index, city.Population.Value);
}
};

var chart = new SKCartesianChart
{
Width = 100,
Height = 100,
Series = new[] { sutSeries }
};

_ = chart.GetImage();

var datafactory = sutSeries.DataFactory;
var points = datafactory.Fetch(sutSeries, chart.Core).ToArray();

for (var i = 0; i < points.Length; i++)
{
var point = points[i];
var c = point.Coordinate;
Assert.IsTrue(c.SecondaryValue == i && c.PrimaryValue == 1);
}
}

[TestMethod]
public void FetchCustomTypeObsolete()
{
var sutSeries = new ColumnSeries<City>
{
Values = new City[] { new(1), new(1), new(1), new(1), new(1) },
Mapping = (city, point) =>
{
#pragma warning disable CS0618 // Type or member is obsolete
point.PrimaryValue = city.Population.Value;
point.SecondaryValue = point.Index;
#pragma warning restore CS0618 // Type or member is obsolete
}
Mapping = (city, index) => new(index, city.Population.Value)
};

var chart = new SKCartesianChart
Expand Down Expand Up @@ -265,13 +227,10 @@ public void FetchCoordinateEmpty()
var sutSeries = new ColumnSeries<City>
{
Values = new City[] { new(1), new(null), new(1), new(null), new(1) },
Mapping = (city, point) =>
{
point.Coordinate =
city.Population is null
? Coordinate.Empty
: new(point.Index, city.Population.Value);
}
Mapping = (city, index) =>
city.Population is null
? Coordinate.Empty
: new(index, city.Population.Value)
};

var chart = new SKCartesianChart
Expand Down Expand Up @@ -313,10 +272,7 @@ public void FetchNull()
var sutSeries = new ColumnSeries<City>
{
Values = new City[] { new(1), null, new(1), null, new(1) },
Mapping = (city, point) =>
{
point.Coordinate = new(point.Index, city.Population.Value);
}
Mapping = (city, index) => new(index, city.Population.Value)
};

var chart = new SKCartesianChart
Expand Down

0 comments on commit a442654

Please sign in to comment.