public void TestConstructor_UnknownMoneyFlowSourceRecipientTypeId()
 {
     var entityId     = 1;
     var entityTypeId = -1;
     var id           = 2;
     var model        = new EditedMoneyFlow(id, entityId, entityTypeId);
 }
        public void TestConstructor()
        {
            var entityId     = 1;
            var entityTypeId = MoneyFlowSourceRecipientType.Office.Id;
            var id           = 2;
            var model        = new EditedMoneyFlow(id, entityId, entityTypeId);

            Assert.AreEqual(id, model.Id);
            Assert.AreEqual(entityTypeId, model.SourceOrRecipientEntityTypeId);
            Assert.AreEqual(entityId, model.SourceOrRecipientEntityId);
        }
        public void TestInit()
        {
            expectedMoneyFlow = null;
            moneyFlowService  = new Mock <IMoneyFlowService>();
            userProvider      = new Mock <IUserProvider>();
            controller        = new MoneyFlowsController(moneyFlowService.Object, userProvider.Object);


            Action <EditedMoneyFlow> updateOrDeleteMoneyFlowCallback = (givenMoneyFlow) =>
            {
                Assert.IsNotNull(expectedMoneyFlow, "Call SetExpectedEditedMoneyFlow in the update or delete test.");
                Assert.AreEqual(expectedMoneyFlow.Id, givenMoneyFlow.Id);
                Assert.AreEqual(expectedMoneyFlow.SourceOrRecipientEntityId, givenMoneyFlow.SourceOrRecipientEntityId);
                Assert.AreEqual(expectedMoneyFlow.SourceOrRecipientEntityTypeId, givenMoneyFlow.SourceOrRecipientEntityTypeId);
            };

            moneyFlowService.Setup(x => x.UpdateAsync(It.IsAny <UpdatedMoneyFlow>()))
            .Returns(Task.FromResult <object>(null))
            .Callback(updateOrDeleteMoneyFlowCallback);
            moneyFlowService.Setup(x => x.DeleteAsync(It.IsAny <DeletedMoneyFlow>()))
            .Returns(Task.FromResult <object>(null))
            .Callback(updateOrDeleteMoneyFlowCallback);
        }
 private void SetExpectedEditedMoneyFlow(int id, int entityId, int entityTypeId)
 {
     expectedMoneyFlow = new EditedMoneyFlow(id, entityId, entityTypeId);
 }