示例#1
0
        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());
            }
        }
示例#2
0
        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());
            }
        }
示例#3
0
        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);
        }