public void TestGetSourceEntityId() { var instance = new AdditionalProjectMoneyFlowBindingModel(); instance.ProjectId = 1; Assert.AreEqual(instance.ProjectId, instance.GetEntityId()); }
public async Task TestPostCreateProjectMoneyFlowAsync_InvalidModel() { controller.ModelState.AddModelError("key", "value"); var model = new AdditionalProjectMoneyFlowBindingModel { MoneyFlowStatusId = MoneyFlowStatus.Actual.Id, PeerEntityTypeId = MoneyFlowSourceRecipientType.Project.Id, }; var response = await controller.PostCreateProjectMoneyFlowAsync(model); Assert.IsInstanceOfType(response, typeof(InvalidModelStateResult)); }
public async Task TestPostCreateProjectMoneyFlowAsync() { var model = new AdditionalProjectMoneyFlowBindingModel { MoneyFlowStatusId = MoneyFlowStatus.Actual.Id, PeerEntityTypeId = MoneyFlowSourceRecipientType.Project.Id, }; userProvider.Setup(x => x.GetBusinessUser(It.IsAny <IWebApiUser>())).Returns(new User(1)); var response = await controller.PostCreateProjectMoneyFlowAsync(model); Assert.IsInstanceOfType(response, typeof(OkResult)); userProvider.Verify(x => x.GetBusinessUser(It.IsAny <IWebApiUser>()), Times.Once()); userProvider.Verify(x => x.GetCurrentUser(), Times.Once()); moneyFlowService.Verify(x => x.CreateAsync(It.IsAny <AdditionalMoneyFlow>()), Times.Once()); moneyFlowService.Verify(x => x.SaveChangesAsync(), Times.Once()); }
public void TestGetSourceTypeId() { var instance = new AdditionalProjectMoneyFlowBindingModel(); Assert.AreEqual(MoneyFlowSourceRecipientType.Project.Id, instance.GetEntityTypeId()); }
public Task <IHttpActionResult> PostCreateProjectMoneyFlowAsync([FromBody] AdditionalProjectMoneyFlowBindingModel model) { return(DoCreateAsync(model)); }