Esempio n. 1
0
        private void CreateTestTransfers()
        {
            var transferItem  = _transferHelper.GetTransferItem((int)_item.Id, 2, _assetAccountId, (decimal)_item.BuyingPrice, (decimal)(2 * _item.BuyingPrice));
            var transferItem2 = _transferHelper.GetTransferItem((int)_item.Id, -2, _incomeAccountId, (decimal)_item.BuyingPrice, (decimal)(-2 * _item.BuyingPrice));

            var detail = _transferHelper.GetTransferDetail(new List <TransferItem>()
            {
                transferItem, transferItem2
            });

            var proxy    = new ItemTransferProxy();
            var response = proxy.InsertItemTransfer(detail);

            _testTransfer = proxy.GetItemTransfer(response.DataObject.InsertedEntityId).DataObject;

            var transferItem3  = _transferHelper.GetTransferItem((int)_item.Id, 2, _assetAccountId, (decimal)_item.BuyingPrice, (decimal)(2 * _item.BuyingPrice));
            var transferItem4  = _transferHelper.GetTransferItem((int)_item.Id, -2, _incomeAccountId, (decimal)_item.BuyingPrice, (decimal)(-2 * _item.BuyingPrice));
            var detailToDelete = _transferHelper.GetTransferDetail(new List <TransferItem>()
            {
                transferItem3, transferItem4
            });

            response = proxy.InsertItemTransfer(detailToDelete);

            _testTransferToDeleteId = proxy.InsertItemTransfer(detailToDelete).DataObject.InsertedEntityId;
        }
Esempio n. 2
0
        public void ShouldUpdateExistingTransfer()
        {
            var proxy = new ItemTransferProxy();

            _testTransfer.Summary           = "Updated the summary.";
            _testTransfer.Items[0].Quantity = 5;
            _testTransfer.Items[1].Quantity = -5;
            _testTransfer.Notes             = "Updated the notes.";
            _testTransfer.Tags = new List <string>()
            {
                "Updated"
            };
            _testTransfer.RequiresFollowUp = true;
            _testTransfer.Date             = _testTransfer.Date.AddDays(1);

            var response = proxy.UpdateItemTransfer(_testTransfer, (int)_testTransfer.Id);

            Assert.IsTrue(response.IsSuccessfull);

            var updatedTransfer = proxy.GetItemTransfer((int)_testTransfer.Id);

            Assert.IsTrue(updatedTransfer.DataObject.Items[0].Quantity == 5);
            Assert.IsTrue(updatedTransfer.DataObject.Items[1].Quantity == -5);
            Assert.IsTrue(updatedTransfer.DataObject.Summary.Equals("Updated the summary."));
            Assert.IsTrue(updatedTransfer.DataObject.Notes.Equals("Updated the notes."));
            Assert.IsTrue(updatedTransfer.DataObject.Date == _testTransfer.Date);
            Assert.IsTrue(updatedTransfer.DataObject.RequiresFollowUp.Value);
        }
Esempio n. 3
0
        public void ShouldFailGetItemTransferWithBadId()
        {
            var proxy    = new ItemTransferProxy();
            var response = proxy.GetItemTransfer((int)_testTransfer.Id - 1);

            Assert.IsFalse(response.IsSuccessfull);
            Assert.IsNull(response.DataObject);
        }
Esempio n. 4
0
        public void ShouldFailGetItemTransferWrongId()
        {
            var proxy    = new ItemTransferProxy();
            var response = proxy.GetItemTransfer(9999999);

            Assert.IsFalse(response.IsSuccessfull);
            Assert.IsNull(response.DataObject);
            Assert.IsTrue(response.RawResponse.Contains("The requested transaction is not found."));
        }
Esempio n. 5
0
        public void ShouldGetExistingItemTransfer()
        {
            var proxy = new ItemTransferProxy();

            var response = proxy.GetItemTransfer((int)_testTransfer.Id);

            Assert.IsTrue(response.IsSuccessfull);
            Assert.IsNotNull(response.DataObject);
            Assert.IsTrue(response.DataObject.Id == (int)_testTransfer.Id);
        }