Enable ticket activity rows by default
This commit is contained in:
@@ -111,7 +111,7 @@ public class TicketOverviewUpdateServiceTest
|
|||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
public async Task FetchAsync_TicketAndServiceRequestsCapability_IsSeparatedFromCounts()
|
public async Task FetchAsync_TicketAndServiceRequestsCapability_UsesEnabledDefaultAndIsSeparatedFromCounts()
|
||||||
{
|
{
|
||||||
// Arrange
|
// Arrange
|
||||||
var communication = new FakeCommunication();
|
var communication = new FakeCommunication();
|
||||||
@@ -128,6 +128,7 @@ public class TicketOverviewUpdateServiceTest
|
|||||||
var service = CreateService(communication, out _);
|
var service = CreateService(communication, out _);
|
||||||
var availabilityChanges = 0;
|
var availabilityChanges = 0;
|
||||||
service.TicketAndServiceRequestsAvailabilityChanged += (_, _) => availabilityChanges++;
|
service.TicketAndServiceRequestsAvailabilityChanged += (_, _) => availabilityChanges++;
|
||||||
|
Assert.True(service.TicketAndServiceRequestsEnabled);
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
service.UpdateAvailability(true);
|
service.UpdateAvailability(true);
|
||||||
@@ -135,7 +136,7 @@ public class TicketOverviewUpdateServiceTest
|
|||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
Assert.True(service.TicketAndServiceRequestsEnabled);
|
Assert.True(service.TicketAndServiceRequestsEnabled);
|
||||||
Assert.Equal(1, availabilityChanges);
|
Assert.Equal(0, availabilityChanges);
|
||||||
Assert.Equal(2, service.CurrentCounts["ServiceRequestsNew"].Personal);
|
Assert.Equal(2, service.CurrentCounts["ServiceRequestsNew"].Personal);
|
||||||
Assert.Equal(4, service.CurrentCounts["ServiceRequestsNew"].Role);
|
Assert.Equal(4, service.CurrentCounts["ServiceRequestsNew"].Role);
|
||||||
Assert.DoesNotContain("TicketAndServiceRequestsEnabled", service.CurrentCounts.Keys);
|
Assert.DoesNotContain("TicketAndServiceRequestsEnabled", service.CurrentCounts.Keys);
|
||||||
@@ -146,8 +147,17 @@ public class TicketOverviewUpdateServiceTest
|
|||||||
});
|
});
|
||||||
await service.FetchAsync(TileScope.Personal);
|
await service.FetchAsync(TileScope.Personal);
|
||||||
|
|
||||||
|
Assert.True(service.TicketAndServiceRequestsEnabled);
|
||||||
|
Assert.Equal(0, availabilityChanges);
|
||||||
|
|
||||||
|
communication.SetCounts(TileScope.Personal, new Dictionary<string, int>(StringComparer.OrdinalIgnoreCase)
|
||||||
|
{
|
||||||
|
["TicketAndServiceRequestsEnabled"] = 0
|
||||||
|
});
|
||||||
|
await service.FetchAsync(TileScope.Personal);
|
||||||
|
|
||||||
Assert.False(service.TicketAndServiceRequestsEnabled);
|
Assert.False(service.TicketAndServiceRequestsEnabled);
|
||||||
Assert.Equal(2, availabilityChanges);
|
Assert.Equal(1, availabilityChanges);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static TicketOverviewUpdateService CreateService(FakeCommunication communication, out FakeDispatcher dispatcher)
|
private static TicketOverviewUpdateService CreateService(FakeCommunication communication, out FakeDispatcher dispatcher)
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ namespace FasdDesktopUi.Basics.Services
|
|||||||
#region Fields
|
#region Fields
|
||||||
|
|
||||||
private const string TicketAndServiceRequestsEnabledKey = "TicketAndServiceRequestsEnabled";
|
private const string TicketAndServiceRequestsEnabledKey = "TicketAndServiceRequestsEnabled";
|
||||||
|
private const bool TicketAndServiceRequestsEnabledDefault = true;
|
||||||
private readonly ITicketOverviewCommunicationSource _communicationSource;
|
private readonly ITicketOverviewCommunicationSource _communicationSource;
|
||||||
private static readonly string[] OverviewKeys = new[]
|
private static readonly string[] OverviewKeys = new[]
|
||||||
{
|
{
|
||||||
@@ -58,7 +59,7 @@ namespace FasdDesktopUi.Basics.Services
|
|||||||
private bool _isDemo;
|
private bool _isDemo;
|
||||||
private bool _initialized;
|
private bool _initialized;
|
||||||
private bool _isEnabled;
|
private bool _isEnabled;
|
||||||
private bool _ticketAndServiceRequestsEnabled;
|
private bool _ticketAndServiceRequestsEnabled = TicketAndServiceRequestsEnabledDefault;
|
||||||
private readonly Random _random = new Random();
|
private readonly Random _random = new Random();
|
||||||
#if isDemo
|
#if isDemo
|
||||||
private readonly List<DemoTicketRecord> _persistedDemoTickets = new List<DemoTicketRecord>();
|
private readonly List<DemoTicketRecord> _persistedDemoTickets = new List<DemoTicketRecord>();
|
||||||
@@ -343,7 +344,7 @@ namespace FasdDesktopUi.Basics.Services
|
|||||||
: OverviewKeys;
|
: OverviewKeys;
|
||||||
var rawCounts = await communication.GetTicketOverviewCounts(requestedKeys, scope == TileScope.Role).ConfigureAwait(false);
|
var rawCounts = await communication.GetTicketOverviewCounts(requestedKeys, scope == TileScope.Role).ConfigureAwait(false);
|
||||||
var counts = new Dictionary<string, int>(StringComparer.OrdinalIgnoreCase);
|
var counts = new Dictionary<string, int>(StringComparer.OrdinalIgnoreCase);
|
||||||
var ticketAndServiceRequestsEnabled = _isDemo;
|
var ticketAndServiceRequestsEnabled = TicketAndServiceRequestsEnabledDefault;
|
||||||
|
|
||||||
if (rawCounts != null)
|
if (rawCounts != null)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -121,10 +121,10 @@
|
|||||||
<RowDefinition Height="Auto" />
|
<RowDefinition Height="Auto" />
|
||||||
<RowDefinition Height="Auto" />
|
<RowDefinition Height="Auto" />
|
||||||
<RowDefinition x:Name="TicketsRow"
|
<RowDefinition x:Name="TicketsRow"
|
||||||
Height="0" />
|
Height="Auto" />
|
||||||
<RowDefinition Height="Auto" />
|
<RowDefinition Height="Auto" />
|
||||||
<RowDefinition x:Name="ServiceRequestsRow"
|
<RowDefinition x:Name="ServiceRequestsRow"
|
||||||
Height="0" />
|
Height="Auto" />
|
||||||
<RowDefinition Height="Auto" />
|
<RowDefinition Height="Auto" />
|
||||||
</Grid.RowDefinitions>
|
</Grid.RowDefinitions>
|
||||||
<Grid.ColumnDefinitions>
|
<Grid.ColumnDefinitions>
|
||||||
|
|||||||
Reference in New Issue
Block a user