private void ShouldReturnSuccessForUpdate() { var operationSecceded = false; var dataAccessJsonStr = string.Empty; var formattedJsonStr = string.Empty; try { var model = new KasAwalModel() { id = 1, tanggal = DateTime.Now.Date, total = 123456 }; _services.Update(model); operationSecceded = true; } catch (DataAccessException ex) { operationSecceded = ex.DataAccessStatusInfo.OperationSucceeded; dataAccessJsonStr = JsonConvert.SerializeObject(ex.DataAccessStatusInfo); formattedJsonStr = JToken.Parse(dataAccessJsonStr).ToString(); } try { Assert.True(operationSecceded); _testOutputHelper.WriteLine("Data berhasil diubah."); } finally { _testOutputHelper.WriteLine(formattedJsonStr); } }
public void ShouldReturnModelMatchingTanggal() { KasAwalModel model = null; var tanggalToGet = DateTime.Now.Date.AddDays(2); try { model = (KasAwalModel)_services.GetByTanggal(tanggalToGet); } catch (DataAccessException ex) { _testOutputHelper.WriteLine(ex.DataAccessStatusInfo.GetFormatedValues()); } Assert.True(model != null); Assert.True(model.tanggal == tanggalToGet); if (model != null) { TestsHelper.WriteModel(_testOutputHelper, model); } }
public KasAwalServicesFixture() { Model = new KasAwalModel(); Services = new KasAwalServices(null, new ModelDataAnnotationCheck()); }