Пример #1
0
        /// <summary>
        /// Create a new HeadOffice object.
        /// </summary>
        /// <param name="id">Initial value of the Id property.</param>
        /// <param name="name">Initial value of the Name property.</param>
        public static HeadOffice CreateHeadOffice(global::System.Guid id, global::System.String name)
        {
            HeadOffice headOffice = new HeadOffice();

            headOffice.Id   = id;
            headOffice.Name = name;
            return(headOffice);
        }
Пример #2
0
        public void AddHeadOfficeTest()
        {
            //Add first
            _repository.Add(headOfficeStub1);
            _repository.SaveChanges();

            //Check whether on database or not
            headOffice = _repository.GetById(headOfficeStub1.Id);
            Assert.IsNotNull(headOffice, "Data Head Office Baru Berhasil Terbuat");

            //Delete so this method can be used again
            _repository.Delete(headOfficeStub1);
            _repository.SaveChanges();
        }
        public HeadOfficeServiceResponse Create(HeadOfficeDomain headOffice)
        {
            HeadOfficeServiceResponse response = new HeadOfficeServiceResponse();

            if (!validateIsNotExist(headOffice.Id))
                response.Messages.Add(new Message("Data is already on database"));
            else
            {
                headOfficeEntity = new HeadOffice();
                MergeExtension.Merge(headOfficeEntity, headOffice);
                _headOfficeRepository.Add(headOfficeEntity);
                _headOfficeRepository.SaveChanges();
            }

            return response;
        }
Пример #4
0
 /// <summary>
 /// Create a new HeadOffice object.
 /// </summary>
 /// <param name="id">Initial value of the Id property.</param>
 /// <param name="name">Initial value of the Name property.</param>
 public static HeadOffice CreateHeadOffice(global::System.Guid id, global::System.String name)
 {
     HeadOffice headOffice = new HeadOffice();
     headOffice.Id = id;
     headOffice.Name = name;
     return headOffice;
 }
Пример #5
0
 /// <summary>
 /// Deprecated Method for adding a new object to the HeadOffices EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToHeadOffices(HeadOffice headOffice)
 {
     base.AddObject("HeadOffices", headOffice);
 }
Пример #6
0
 /// <summary>
 /// Deprecated Method for adding a new object to the HeadOffices EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToHeadOffices(HeadOffice headOffice)
 {
     base.AddObject("HeadOffices", headOffice);
 }
Пример #7
0
        public void DeleteHeadOfficeTest()
        {
            //Add first to make data dummy
            _repository.Add(headOfficeStub1);
            _repository.SaveChanges();

            //Delete
            _repository.Delete(headOfficeStub1);
            _repository.SaveChanges();

            //make sure wheter data is no longer in database
            headOffice = _repository.GetById(headOfficeStub1.Id);
            Assert.IsNull(headOffice, "Head Office Terhapus");
        }
Пример #8
0
 public void UpdateNullHeadOfficeTest()
 {
     _repository.Update(headOfficeUpdateStub1);
     _repository.SaveChanges();
     headOffice = _repository.GetById(headOfficeUpdateStub1.Id);
 }
Пример #9
0
        public void UpdateHeadOfficeTest()
        {
            //precondition
            _repository.Add(headOfficeInsertStub1);
            _repository.SaveChanges();

            _repository.Update(headOfficeUpdateStub1);
            _repository.SaveChanges();
            headOffice = _repository.GetById(headOfficeUpdateStub1.Id);
            Assert.AreEqual(headOffice.Address, headOfficeUpdateStub1.Address);

            //delete data
            _repository.Delete(headOfficeUpdateStub1);
            _repository.SaveChanges();
        }