Beispiel #1
0
        public void MapToContract_MapStateEnum_Correctly(Contract.Model.SalesInvoiceStatus output, string input)
        {
            var salesInvoice = new SalesInvoiceGet()
            {
                state = input
            };
            var result = _mapper.MapToContract(salesInvoice);

            result.State.Should().BeEquivalentTo(output);
        }
Beispiel #2
0
        public void MapToApi_MapStateEnum_Correctly(Contract.Model.SalesInvoiceStatus input, string output)
        {
            var current      = new SalesInvoiceGet();
            var salesInvoice = new Contract.Model.SalesInvoice()
            {
                State = input
            };
            var result = _mapper.MapToApi(salesInvoice, current);

            result.state.Should().BeEquivalentTo(output);
        }
        private string GetApiState(Contract.Model.SalesInvoiceStatus state)
        {
            switch (state)
            {
            case Contract.Model.SalesInvoiceStatus.Paid:
                return("paid");

            case Contract.Model.SalesInvoiceStatus.Draft:
                return("draft");

            case Contract.Model.SalesInvoiceStatus.Late:
                return("late");

            case Contract.Model.SalesInvoiceStatus.Open:
                return("open");

            default:
                throw new NotSupportedException($"State: {state} is not supported");
            }
        }