Untitled

 avatar
unknown
plain_text
a year ago
5.4 kB
5
Indexable
using DataCost.Constants;
using DataCost.Infrastructure.Data;
using DataCost.Models;

namespace DataCost.Test.Builders;

public class ParsedExcelRecordBuilder
{
    private int _orderNumber;

    private int _knosDbId;

    private string _customer;

    private string _soOrderRef;

    private string _poNumber;

    private string _station;

    private string _antenna;

    private string _satellite;

    private DateOnly _acquireDate;

    private TimeOnly _plannedStartTime;

    private double _upperLeftLat;

    private double _upperLeftLon;

    private double _upperRightLat;

    private double _upperRightLon;

    private double _lowerLeftLat;

    private double _lowerLeftLon;

    private double _lowerRightLat;

    private double _lowerRightLon;

    private int _orbit;

    private string _product;

    private double _productCount;

    private string _productInfo;

    private string _orderStatus;

    private string _invoiceInfo;

    private string _comments;
    
    private string _c2AType;

    private Dictionary<string, List<string>> _contracts;

    private Random _random;
    
    public ParsedExcelRecordBuilder()
    {
        // Default values for builder
        _orderNumber = 41807;
        _knosDbId = 81451051;
        _customer = string.Empty;
        _soOrderRef = string.Empty;
        _poNumber = string.Empty;
        _station = string.Empty; // Usually not important for data cost calculation? More likely to be a fee related thing?
        _antenna = string.Empty;
        _satellite = string.Empty;
        _acquireDate = DateOnly.FromDateTime(DateTime.Today);
        _plannedStartTime = TimeOnly.FromDateTime(DateTime.Now);
        _upperLeftLat = 0.0;
        _upperLeftLon = 0.0;
        _upperRightLat = 0.0;
        _upperRightLon = 0.0;
        _lowerLeftLat = 0.0;
        _lowerLeftLon = 0.0;
        _lowerRightLat = 0.0;
        _lowerRightLon = 0.0;
        _orbit = 93597;
        _product = "DefaultProduct";
        _productCount = 1.0;
        _productInfo = "Some irrelevant information";
        _orderStatus = "Success";
        _invoiceInfo = string.Empty;
        _comments = string.Empty;
        _c2AType = string.Empty;
        
        _contracts = SeedCustomerContractData.GetCustomerContracts();
    }
    
    public ParsedExcelRecordBuilder Radarsat2OrderC2a()
    {
        _satellite = SatelliteNames.Radarsat2;
        _customer = _contracts["C2a"].First();
        _product = "RS2_W_S";
        return this;
    }
    
    public ParsedExcelRecordBuilder Radarsat2OrderC2b()
    {
        _satellite = SatelliteNames.Radarsat2;
        _customer = _customer = _contracts["C2b"].First();
        _product = "RS2_W_S";
        return this;
    }
    
    public ParsedExcelRecordBuilder Radarsat2OrderFB()
    {
        _satellite = SatelliteNames.Radarsat2;
        _customer = _contracts["FB"].First();
        _product = "RS2_W_S";
        return this;
    }
    
    public ParsedExcelRecordBuilder TsxTdxPazOrderStandardCustomer()
    {
        _satellite = SatelliteNames.TsxTdxPaz;
        _customer = CustomerNames.Jac;
        _product = "TSX_SM_A";
        return this;
    }
    
    public ParsedExcelRecordBuilder TsxTdxPazOrderSpecialPrice()
    {
        _satellite = SatelliteNames.TsxTdxPaz;
        _customer = CustomerNames.DmiDkk;
        _product = "TSX_SM_A";
        return this;
    }

    public ParsedExcelRecordBuilder CosmoSkyMedOrderStandardCustomer()
    {
        _satellite = SatelliteNames.CosmoSkyMed;
        _customer = CustomerNames.Equinor;
        _product = "SCK_SL";
        return this;
    }
    
    // test for same pass and different pass
    public ParsedExcelRecordBuilder Gf3OrderOne()
    {
        _satellite = SatelliteNames.Gf3;
        _customer = CustomerNames.Nofo;
        _product = "GF3_SL";
        return this;
    }
    
    public ParsedExcelRecordBuilder Gf3OrderTwo()
    {
        _satellite = SatelliteNames.Gf3;
        _customer = CustomerNames.Nofo;
        _product = "GF3_SL";
        return this;
    }
    
    
    
    
    public ParsedExcelRecord Build()
    {
        return new ParsedExcelRecord
        {
            OrderNumber = _orderNumber,
            KnosDbId = _knosDbId,
            Customer = _customer,
            SoOrderRef = _soOrderRef,
            PONumber = _poNumber,
            Station = _station,
            Antenna = _antenna,
            Satellite = _satellite,
            AcquireDate = _acquireDate,
            PlannedStartTime = _plannedStartTime,
            UpperLeftLat = _upperLeftLat,
            UpperLeftLon = _upperLeftLon,
            UpperRightLat = _upperRightLat,
            UpperRightLon = _upperRightLon,
            LowerLeftLat = _lowerLeftLat,
            LowerLeftLon = _lowerLeftLon,
            LowerRightLat = _lowerRightLat,
            LowerRightLon = _lowerRightLon,
            Orbit = _orbit,
            Product = _product,
            ProductCount = _productCount,
            ProductInfo = _productInfo,
            OrderStatus = _orderStatus,
            InvoiceInfo = _invoiceInfo,
            Comments = _comments,
            C2AType = _c2AType
        };
    }
}
Editor is loading...
Leave a Comment