public void TestGetSourceEntityId() { var instance = new AdditionalOfficeMoneyFlowBindingModel(); instance.OfficeId = 1; Assert.AreEqual(instance.OfficeId, instance.GetEntityId()); }
public async Task TestPostOfficeProjectMoneyFlowAsync_InvalidModel() { controller.ModelState.AddModelError("key", "value"); var model = new AdditionalOfficeMoneyFlowBindingModel { MoneyFlowStatusId = MoneyFlowStatus.Actual.Id, PeerEntityTypeId = MoneyFlowSourceRecipientType.Organization.Id, }; var response = await controller.PostCreateOfficeMoneyFlowAsync(model); Assert.IsInstanceOfType(response, typeof(InvalidModelStateResult)); }
public async Task TestPostCreateOfficeMoneyFlowAsync() { var model = new AdditionalOfficeMoneyFlowBindingModel { MoneyFlowStatusId = MoneyFlowStatus.Actual.Id, PeerEntityTypeId = MoneyFlowSourceRecipientType.Organization.Id, }; userProvider.Setup(x => x.GetBusinessUser(It.IsAny <IWebApiUser>())).Returns(new User(1)); var response = await controller.PostCreateOfficeMoneyFlowAsync(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 AdditionalOfficeMoneyFlowBindingModel(); Assert.AreEqual(MoneyFlowSourceRecipientType.Office.Id, instance.GetEntityTypeId()); }
public Task <IHttpActionResult> PostCreateOfficeMoneyFlowAsync([FromBody] AdditionalOfficeMoneyFlowBindingModel model) { return(DoCreateAsync(model)); }