public IHttpActionResult UpdateContainer(EAV.Store.IStoreContainer container)
        {
            try
            {
                containerClient.UpdateContainer(container);

                return(Ok());
            }
            catch (Exception ex)
            {
                return(InternalServerError(ex));
            }
        }
Beispiel #2
0
        public void UpdateContainer()
        {
            var    dbContainer    = SelectRandomItem(this.DbContext.Containers);
            string oldName        = dbContainer.Name;
            string oldDataName    = dbContainer.Data_Name;
            string oldDisplayText = dbContainer.Display_Text;
            bool   oldIsRepeating = dbContainer.Is_Repeating;
            int    oldSequence    = dbContainer.Sequence;

            EAV.Store.Clients.IContainerStoreClient client = factory.Create <EAV.Store.Clients.IContainerStoreClient>();

            var container = (EAVStoreLibrary.StoreContainer)dbContainer;

            container.Name        = oldName.Flip();
            container.DataName    = oldDataName.Flip();
            container.DisplayText = oldDisplayText.Flip();
            container.IsRepeating = !oldIsRepeating;
            container.Sequence    = -oldSequence;

            client.UpdateContainer(container);

            ResetDatabaseContext();

            dbContainer = this.dbContext.Containers.Single(it => it.Container_ID == container.ContainerID);

            Assert.AreEqual(container.Name, dbContainer.Name);
            Assert.AreNotEqual(oldName, dbContainer.Name);
            Assert.AreEqual(container.DataName, dbContainer.Data_Name);
            Assert.AreNotEqual(oldDataName, dbContainer.Data_Name);
            Assert.AreEqual(container.DisplayText, dbContainer.Display_Text);
            Assert.AreNotEqual(oldDisplayText, dbContainer.Display_Text);
            Assert.AreEqual(container.IsRepeating, dbContainer.Is_Repeating);
            Assert.AreNotEqual(oldIsRepeating, dbContainer.Is_Repeating);
            Assert.AreEqual(container.Sequence, dbContainer.Sequence);
            Assert.AreNotEqual(oldSequence, dbContainer.Sequence);
        }