public void TestInsertVolume() { Volume volumeDto = new Volume(); volumeDto.VolumeYear = "2008"; volumeDto.VolumeName = "custom volume name"; volumeDto.CreationUserId = 2; volumeDto.IsActive = true; try { VolumeDALC dalc = new VolumeDALC(); volumeDtoAfterInsert = dalc.Insert(volumeDto); Volume volumeDtoAfterSelect = dalc.Select(volumeDtoAfterInsert); Assert.AreEqual(volumeDto.VolumeName, volumeDtoAfterSelect.VolumeName, "VolumeName"); Assert.AreEqual(volumeDto.VolumeYear, volumeDtoAfterSelect.VolumeYear, "VolumeYear"); Assert.AreEqual(volumeDto.IsActive, volumeDtoAfterSelect.IsActive, "IsActive"); Assert.AreEqual(volumeDto.CreationUserId, volumeDtoAfterSelect.CreationUserId, "CreationUserId"); Assert.AreEqual(volumeDto.CreationUserId, volumeDtoAfterSelect.UpdateUserId, "UpdateUserId"); Assert.AreEqual(volumeDtoAfterSelect.CreationDateTime, volumeDtoAfterSelect.UpdateDateTime, "Create/Update DateTime"); } catch (Exception ex) { Assert.Fail(ex.ToString()); Console.WriteLine(ex.ToString()); } }
public void TestInsertVolumeCleanup() { try { VolumeDALC dalc = new VolumeDALC(); Int32 status = dalc.Delete(volumeDtoAfterInsert); Assert.AreEqual(0, status, "Delete failed"); } catch (Exception ex) { Assert.Fail(ex.ToString()); Console.WriteLine(ex.ToString()); } }
public ActionStatus InsertVolume(Volume insertDto) { ActionStatus status = new ActionStatus(); try { VolumeDALC dalc = new VolumeDALC(GetTransaction()); //Start tran Start(); dalc.Insert(insertDto); //commit tran SetComplete(); status.IsSuccessful = true; status.Messages.Add(new ActionMessage("Volume successfully added.")); } catch (MNException mnEx) { //TODO: Log error //abort tran SetAbort(); throw mnEx; } catch (Exception ex) { //TODO: Log error //abort tran SetAbort(); throw ex; } return(status); }