Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create unit test for GridVisualizationExtensions class #186

Merged
merged 2 commits into from
Dec 25, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
using Reveal.Sdk.Dom.Visualizations;
using Reveal.Sdk.Dom.Visualizations.Settings;
using System;
using System.Collections.Generic;
using System.Drawing.Printing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Xunit;

namespace Reveal.Sdk.Dom.Tests.Visualizations.Extensions.Visualizations
{
public class GridVisualizationExtensionsFixture
{
[Fact]
public void ConfigureSettings_UpdateSettingsField_WithoutConditions()
{
// Arrange
var vs = new GridVisualization();
hainv-ohio marked this conversation as resolved.
Show resolved Hide resolved
var expectedSettings = new GridVisualizationSettings()
{
DateFieldAlignment = Alignment.Center,
FontSize = FontSize.Large,
IsFirstColumnFixed = false,
IsPagingEnabled = true,
NumericFieldAlignment = Alignment.Left,
PageSize = 5,
SchemaTypeName = "Test Schema Type Name",
Style = new GridVisualizationStyle()
{
DateAlignment = Alignment.Left,
FixedLeftColumns = false,
NumericAlignment = Alignment.Right,
TextAlignment = Alignment.Right
},
TextFieldAlignment = Alignment.Right,
VisualizationType = "Test VS Type"
};

var action = (GridVisualizationSettings s) =>
{
s.DateFieldAlignment = expectedSettings.DateFieldAlignment;
s.FontSize = expectedSettings.FontSize;
s.IsFirstColumnFixed = expectedSettings.IsFirstColumnFixed;
s.IsPagingEnabled = expectedSettings.IsPagingEnabled;
s.NumericFieldAlignment = expectedSettings.NumericFieldAlignment;
s.PageSize = expectedSettings.PageSize;
s.SchemaTypeName = expectedSettings.SchemaTypeName;
s.Style = expectedSettings.Style;
s.TextFieldAlignment = expectedSettings.TextFieldAlignment;
s.VisualizationType = expectedSettings.VisualizationType;
};

// Act
vs.ConfigureSettings(action);

// Assert
Assert.Equivalent(expectedSettings, vs.Settings);
}

}
}
Loading