private static TenureViewModel ToResponse(this TenureInformation domain) { if (domain == null) { return(null); } return(new TenureViewModel { TypeCode = domain.TypeCode, TypeDescription = domain.TypeDescription }); }
public static PropertyViewModel ToResponse(this PropertyModel domain, TenureInformation tenure) { bool canRaiseRepair = (tenure is null) || tenure.CanRaiseRepair; //(!domain.NoMaint.HasValue || !domain.NoMaint.Value) && //(string.IsNullOrWhiteSpace(domain.OccStat) || !domain.OccStat.Contains("DS")); // Note to future developer integrating with Assets API - ensure OCC STAT and NO MAINT and taken in to consideration as above! return(new PropertyViewModel { CanRaiseRepair = canRaiseRepair, // If there is no tenure then we CAN raise repairs PropertyReference = domain.PropertyReference, Address = domain.Address.ToResponse(), HierarchyType = domain.HierarchyType.ToResponse(), TmoName = domain.TmoName }); }
public void Setup() { _fixture = new Fixture(); _fixture.Behaviors.Remove(new ThrowingRecursionBehavior()); _fixture.Behaviors.Add(new OmitOnRecursionBehavior()); _workOrderGenerator = new Helpers.StubGeneration.Generator <WorkOrder>() .AddInfrastructureWorkOrderGenerators(); _sessionId = "sessionId"; _sorGatewayMock = new Mock <IScheduleOfRatesGateway>(); _alertsGatewayMock = new Mock <IAlertsGateway>(); _tenureInformationUseCaseMock = new Mock <ITenureInformationUseCase>(); _sorPriorityGatewayMock = new Mock <ISorPriorityGateway>(); _classUnderTest = new DrsMapping( _sorGatewayMock.Object, _alertsGatewayMock.Object, _tenureInformationUseCaseMock.Object, _sorPriorityGatewayMock.Object, new NullLogger <DrsMapping>() ); _locationAlerts = new Helpers.StubGeneration.Generator <PropertyAlertList>().AddDefaultGenerators().Generate(); _personAlerts = new Helpers.StubGeneration.Generator <PersonAlertList>().AddDefaultGenerators().Generate(); var commonAlerts = new Helpers.StubGeneration.Generator <Alert>().AddDefaultGenerators().GenerateList(5); _locationAlerts.Alerts = _locationAlerts.Alerts.Union(commonAlerts); _personAlerts.Alerts = _personAlerts.Alerts.Union(commonAlerts); _tenureInformation = new Helpers.StubGeneration.Generator <TenureInformation>().AddDefaultGenerators().Generate(); _alertsGatewayMock.Setup(x => x.GetLocationAlertsAsync(It.IsAny <string>())) .ReturnsAsync(_locationAlerts); _alertsGatewayMock.Setup(x => x.GetPersonAlertsAsync(It.IsAny <string>())) .ReturnsAsync(_personAlerts); _tenureInformationUseCaseMock .Setup(x => x.GetTenureInformationWithPropertyReference(It.IsAny <string>())) .ReturnsAsync(_tenureInformation); }