private RequestViewModel CreateRequestViewModelFromEntity(RequestEntity requestEntity) { var requestViewModel = new RequestViewModel(Application, requestEntity.PersistentId); requestViewModel.Refresh(); return(requestViewModel); }
private void OnCreateRequest(RequestDialogViewModel requestDialog) { var requestEntityId = Application.Repository.CreateRequest(new RequestEntityData { Date = requestDialog.DateProperty.Value, Description = requestDialog.DescriptionProperty.Value, Value = requestDialog.CalculateValue, CategoryPersistentId = requestDialog.Categories.Value != null ? requestDialog.Categories.Value.EntityId : null }); var requestViewModel = new RequestViewModel(Application, requestEntityId); requestViewModel.Refresh(); Requests.AddValue(requestViewModel); UpdateSaldoForCurrentMonth(); }
public void Refresh(double value) { var viewModel = new RequestViewModel(Application, DefaultEntityId); var requestDate = new DateTime(2014, 5, 5); var requestEntity = Substitute.For<RequestEntity>(); requestEntity.Date.Returns(requestDate); requestEntity.Value.Returns(value); requestEntity.Description.Returns("TestDescription"); Repository.QueryRequest(DefaultEntityId).Returns(requestEntity); viewModel.Refresh(); Repository.Received(1).QueryRequest(DefaultEntityId); Assert.That(viewModel.Date, Is.EqualTo(requestDate)); Assert.That(viewModel.IsStandingOrder, Is.False); Assert.That(viewModel.DateAsString, Is.EqualTo(string.Format(Properties.Resources.RequestDateFormat, requestDate))); Assert.That(viewModel.Value, Is.EqualTo(value)); Assert.That(viewModel.ValueAsString, Is.EqualTo(string.Format(Properties.Resources.MoneyValueFormat, value))); Assert.That(viewModel.Description, Is.EqualTo("TestDescription")); }
private void OnCreateRequest(RequestDialogViewModel requestDialog) { var requestEntityId = Application.Repository.CreateRequest(new RequestEntityData { Date = requestDialog.DateProperty.Value, Description = requestDialog.DescriptionProperty.Value, Value = requestDialog.CalculateValue, CategoryPersistentId = requestDialog.Categories.Value != null ? requestDialog.Categories.Value.EntityId : null }); var requestViewModel = new RequestViewModel(Application, requestEntityId); requestViewModel.Refresh(); Requests.AddValue(requestViewModel); UpdateSaldoForCurrentMonth(); }
private RequestViewModel CreateRequestViewModelFromEntity(RequestEntity requestEntity) { var requestViewModel = new RequestViewModel(Application, requestEntity.PersistentId); requestViewModel.Refresh(); return requestViewModel; }