// PUT api/awbuildversion/5
        public void Put(SalesOrderHeaderSalesReason value)
        {
            var GetActionType = Request.Headers.Where(x => x.Key.Equals("ActionType")).FirstOrDefault();

            if (GetActionType.Key != null)
            {
                if (GetActionType.Value.ToList()[0].Equals("DELETE"))
                    adventureWorks_BC.SalesOrderHeaderSalesReasonDelete(value);
                if (GetActionType.Value.ToList()[0].Equals("UPDATE"))
                    adventureWorks_BC.SalesOrderHeaderSalesReasonUpdate(value);
            }
        }
Beispiel #2
0
        /// <summary>
        /// Serialize the mock SalesOrderHeaderSalesReason entity into a temporary file.
        /// </summary>
        private void Step_06_SerializeEntity_Generated()
        {
            using (TransactionManager tm = CreateTransaction())
            {
                mock = CreateMockInstance(tm);
                string fileName = System.IO.Path.Combine(System.IO.Path.GetTempPath(), "temp_SalesOrderHeaderSalesReason.xml");

                EntityHelper.SerializeXml(mock, fileName);
                Assert.IsTrue(System.IO.File.Exists(fileName), "Serialized mock not found");

                System.Console.WriteLine("mock correctly serialized to a temporary file.");
            }
        }
Beispiel #3
0
        public void MapEFToBO()
        {
            var mapper = new DALSalesOrderHeaderSalesReasonMapper();
            SalesOrderHeaderSalesReason entity = new SalesOrderHeaderSalesReason();

            entity.SetProperties(DateTime.Parse("1/1/1987 12:00:00 AM"), 1, 1);

            BOSalesOrderHeaderSalesReason response = mapper.MapEFToBO(entity);

            response.ModifiedDate.Should().Be(DateTime.Parse("1/1/1987 12:00:00 AM"));
            response.SalesOrderID.Should().Be(1);
            response.SalesReasonID.Should().Be(1);
        }
Beispiel #4
0
        public void MapBOToEF()
        {
            var mapper = new DALSalesOrderHeaderSalesReasonMapper();
            var bo     = new BOSalesOrderHeaderSalesReason();

            bo.SetProperties(1, DateTime.Parse("1/1/1987 12:00:00 AM"), 1);

            SalesOrderHeaderSalesReason response = mapper.MapBOToEF(bo);

            response.ModifiedDate.Should().Be(DateTime.Parse("1/1/1987 12:00:00 AM"));
            response.SalesOrderID.Should().Be(1);
            response.SalesReasonID.Should().Be(1);
        }
Beispiel #5
0
        public void MapEFToBOList()
        {
            var mapper = new DALSalesOrderHeaderSalesReasonMapper();
            SalesOrderHeaderSalesReason entity = new SalesOrderHeaderSalesReason();

            entity.SetProperties(DateTime.Parse("1/1/1987 12:00:00 AM"), 1, 1);

            List <BOSalesOrderHeaderSalesReason> response = mapper.MapEFToBO(new List <SalesOrderHeaderSalesReason>()
            {
                entity
            });

            response.Count.Should().Be(1);
        }
Beispiel #6
0
 public bool SalesOrderHeaderSalesReasonDelete(SalesOrderHeaderSalesReason salesorderheadersalesreason)
 {
     return(Execute <bool>(dal =>
     {
         SalesOrderHeaderSalesReason salesorderheadersalesreasonDelete = dal.SalesOrderHeaderSalesReason.Where(x => x.SalesOrderID == salesorderheadersalesreason.SalesOrderID).FirstOrDefault();
         if (salesorderheadersalesreasonDelete != null)
         {
             dal.SalesOrderHeaderSalesReason.DeleteOnSubmit(salesorderheadersalesreasonDelete);
             dal.SubmitChanges();
             return true;
         }
         return false;
     }));
 }
Beispiel #7
0
        ///<summary>
        ///  Update the Typed SalesOrderHeaderSalesReason Entity with modified mock values.
        ///</summary>
        static public void UpdateMockInstance_Generated(TransactionManager tm, SalesOrderHeaderSalesReason mock)
        {
            mock.ModifiedDate = TestUtility.Instance.RandomDateTime();

            //OneToOneRelationship
            SalesOrderHeader mockSalesOrderHeaderBySalesOrderId = SalesOrderHeaderTest.CreateMockInstance(tm);

            DataRepository.SalesOrderHeaderProvider.Insert(tm, mockSalesOrderHeaderBySalesOrderId);
            mock.SalesOrderId = mockSalesOrderHeaderBySalesOrderId.SalesOrderId;

            //OneToOneRelationship
            SalesReason mockSalesReasonBySalesReasonId = SalesReasonTest.CreateMockInstance(tm);

            DataRepository.SalesReasonProvider.Insert(tm, mockSalesReasonBySalesReasonId);
            mock.SalesReasonId = mockSalesReasonBySalesReasonId.SalesReasonId;
        }
Beispiel #8
0
        /// <summary>
        /// Serialize a SalesOrderHeaderSalesReason collection into a temporary file.
        /// </summary>
        private void Step_08_SerializeCollection_Generated()
        {
            using (TransactionManager tm = CreateTransaction())
            {
                string fileName = System.IO.Path.Combine(System.IO.Path.GetTempPath(), "temp_SalesOrderHeaderSalesReasonCollection.xml");

                mock = CreateMockInstance(tm);
                TList <SalesOrderHeaderSalesReason> mockCollection = new TList <SalesOrderHeaderSalesReason>();
                mockCollection.Add(mock);

                EntityHelper.SerializeXml(mockCollection, fileName);

                Assert.IsTrue(System.IO.File.Exists(fileName), "Serialized mock collection not found");
                System.Console.WriteLine("TList<SalesOrderHeaderSalesReason> correctly serialized to a temporary file.");
            }
        }
        // PUT api/awbuildversion/5
        public void Put(SalesOrderHeaderSalesReason value)
        {
            var GetActionType = Request.Headers.Where(x => x.Key.Equals("ActionType")).FirstOrDefault();

            if (GetActionType.Key != null)
            {
                if (GetActionType.Value.ToList()[0].Equals("DELETE"))
                {
                    adventureWorks_BC.SalesOrderHeaderSalesReasonDelete(value);
                }
                if (GetActionType.Value.ToList()[0].Equals("UPDATE"))
                {
                    adventureWorks_BC.SalesOrderHeaderSalesReasonUpdate(value);
                }
            }
        }
Beispiel #10
0
        public bool SalesOrderHeaderSalesReasonUpdate(SalesOrderHeaderSalesReason salesorderheadersalesreason)
        {
            return(Execute <bool>(dal =>
            {
                SalesOrderHeaderSalesReason salesorderheadersalesreasonUpdate = dal.SalesOrderHeaderSalesReason.Where(x => x.SalesOrderID == salesorderheadersalesreason.SalesOrderID).FirstOrDefault();
                if (salesorderheadersalesreasonUpdate != null)
                {
                    salesorderheadersalesreasonUpdate.SalesOrderID = salesorderheadersalesreason.SalesOrderID;
                    salesorderheadersalesreasonUpdate.SalesReasonID = salesorderheadersalesreason.SalesReasonID;
                    salesorderheadersalesreasonUpdate.ModifiedDate = salesorderheadersalesreason.ModifiedDate;

                    dal.SubmitChanges();
                    return true;
                }
                return false;
            }));
        }
        public async void Get()
        {
            var mock   = new ServiceMockFacade <ISalesOrderHeaderSalesReasonRepository>();
            var record = new SalesOrderHeaderSalesReason();

            mock.RepositoryMock.Setup(x => x.Get(It.IsAny <int>())).Returns(Task.FromResult(record));
            var service = new SalesOrderHeaderSalesReasonService(mock.LoggerMock.Object,
                                                                 mock.RepositoryMock.Object,
                                                                 mock.ModelValidatorMockFactory.SalesOrderHeaderSalesReasonModelValidatorMock.Object,
                                                                 mock.BOLMapperMockFactory.BOLSalesOrderHeaderSalesReasonMapperMock,
                                                                 mock.DALMapperMockFactory.DALSalesOrderHeaderSalesReasonMapperMock);

            ApiSalesOrderHeaderSalesReasonResponseModel response = await service.Get(default(int));

            response.Should().NotBeNull();
            mock.RepositoryMock.Verify(x => x.Get(It.IsAny <int>()));
        }
Beispiel #12
0
        /// <summary>
        /// Test Find using the Query class
        /// </summary>
        private void Step_30_TestFindByQuery_Generated()
        {
            using (TransactionManager tm = CreateTransaction())
            {
                //Insert Mock Instance
                SalesOrderHeaderSalesReason mock = CreateMockInstance(tm);
                bool result = DataRepository.SalesOrderHeaderSalesReasonProvider.Insert(tm, mock);

                Assert.IsTrue(result, "Could Not Test FindByQuery, Insert Failed");

                SalesOrderHeaderSalesReasonQuery query = new SalesOrderHeaderSalesReasonQuery();

                query.AppendEquals(SalesOrderHeaderSalesReasonColumn.SalesOrderId, mock.SalesOrderId.ToString());
                query.AppendEquals(SalesOrderHeaderSalesReasonColumn.SalesReasonId, mock.SalesReasonId.ToString());
                query.AppendEquals(SalesOrderHeaderSalesReasonColumn.ModifiedDate, mock.ModifiedDate.ToString());

                TList <SalesOrderHeaderSalesReason> results = DataRepository.SalesOrderHeaderSalesReasonProvider.Find(tm, query);

                Assert.IsTrue(results.Count == 1, "Find is not working correctly.  Failed to find the mock instance");
            }
        }
 // POST api/awbuildversion
 public void Post(SalesOrderHeaderSalesReason value)
 {
     adventureWorks_BC.SalesOrderHeaderSalesReasonAdd(value);
 }
 /// <summary>
 /// There are no comments for SalesOrderHeaderSalesReason in the schema.
 /// </summary>
 public void AddToSalesOrderHeaderSalesReason(SalesOrderHeaderSalesReason salesOrderHeaderSalesReason)
 {
     base.AddObject("SalesOrderHeaderSalesReason", salesOrderHeaderSalesReason);
 }
 /// <summary>
 /// Create a new SalesOrderHeaderSalesReason object.
 /// </summary>
 /// <param name="salesOrderID">Initial value of SalesOrderID.</param>
 /// <param name="salesReasonID">Initial value of SalesReasonID.</param>
 /// <param name="modifiedDate">Initial value of ModifiedDate.</param>
 public static SalesOrderHeaderSalesReason CreateSalesOrderHeaderSalesReason(int salesOrderID, int salesReasonID, global::System.DateTime modifiedDate)
 {
     SalesOrderHeaderSalesReason salesOrderHeaderSalesReason = new SalesOrderHeaderSalesReason();
     salesOrderHeaderSalesReason.SalesOrderID = salesOrderID;
     salesOrderHeaderSalesReason.SalesReasonID = salesReasonID;
     salesOrderHeaderSalesReason.ModifiedDate = modifiedDate;
     return salesOrderHeaderSalesReason;
 }
Beispiel #16
0
 /// <summary>
 /// Make any alterations necessary (i.e. for DB check constraints, special test cases, etc.)
 /// </summary>
 /// <param name="mock">Object to be modified</param>
 static private void SetSpecialTestData(SalesOrderHeaderSalesReason mock)
 {
     //Code your changes to the data object here.
 }
 // POST api/awbuildversion
 public void Post(SalesOrderHeaderSalesReason value)
 {
     adventureWorks_BC.SalesOrderHeaderSalesReasonAdd(value);
 }