コード例 #1
0
        public async Task UpdatesAssignedOperativesWhenFeatureFlagSetAndContractorUsesDrs(WorkStatusCode workStatus,
                                                                                          bool updateFeatureEnabled,
                                                                                          bool drsFeatureEnabled,
                                                                                          bool contractorUsesDrs,
                                                                                          bool shouldAssign)
        {
            var expectedWorkOrder = _generator
                                    .AddValue(workStatus, (WorkOrder wo) => wo.StatusCode)
                                    .Generate();

            _repairsGatewayMock.ReturnsWorkOrders(expectedWorkOrder);
            _sorGatewayMock.Setup(x => x.GetContractor(expectedWorkOrder.AssignedToPrimary.ContractorReference))
            .ReturnsAsync(new Contractor
            {
                UseExternalScheduleManager = contractorUsesDrs
            });
            _featureManager.Setup(x => x.IsEnabledAsync(FeatureFlags.UpdateOperativesOnWorkOrderGet))
            .ReturnsAsync(updateFeatureEnabled);
            _featureManager.Setup(x => x.IsEnabledAsync(FeatureFlags.DRSIntegration))
            .ReturnsAsync(drsFeatureEnabled);

            await _classUnderTest.Execute(expectedWorkOrder.Id);

            _drsService.Verify(x => x.UpdateWorkOrderDetails(expectedWorkOrder.Id), shouldAssign ? Times.Once() : Times.Never());
        }
コード例 #2
0
        public async Task SetsMessageTrueWhenMobile(string expectedNumber, bool expectedMessageValue)
        {
            List <Communication> comms = new List <Communication>
            {
                new Communication
                {
                    Channel = new CommunicationChannel
                    {
                        Medium = CommunicationMediumCode._20
                    },
                    Value = expectedNumber
                }
            };

            _workOrderGenerator.AddValue(comms, (Person p) => p.Communication);
            var workOrder = _workOrderGenerator.Generate();

            _sorPriorityGatewayMock.Setup(m => m.GetLegacyPriorityCode(It.IsAny <int>())).ReturnsAsync("I");
            SetupSorCodes(workOrder);

            var request = await _classUnderTest.BuildCreateOrderRequest(_sessionId, workOrder);

            request.createOrder1.theOrder.message.Should().Be(expectedMessageValue);
        }