示例#1
0
        // if the user says ( forall x :: forall y ::  ... ) and specifies *no* triggers, we transform it to
        // (forall x, y ::  ... ) which may help the prover to pick trigger terms
        //
        // (Note: there used to be a different criterion here, which allowed merging when triggers were specified, which could cause prover errors due to resulting unbound variables in the triggers)
        private void MergeAdjecentQuantifier()
        {
            QuantifierExpr qbody = Body as QuantifierExpr;

            if (!(qbody != null && (qbody is ForallExpr) == (this is ForallExpr) && Triggers == null))
            {
                return;
            }
            qbody.MergeAdjecentQuantifier();
            if (this.Triggers != null || qbody.Triggers != null)
            {
                return;
            }
            Body = qbody.Body;
            TypeParameters.AddRange(qbody.TypeParameters);
            Dummies.AddRange(qbody.Dummies);
            Triggers = qbody.Triggers;
            if (qbody.Attributes != null)
            {
                if (Attributes == null)
                {
                    Attributes = qbody.Attributes;
                }
                else
                {
                    QKeyValue p = Attributes;
                    while (p.Next != null)
                    {
                        p = p.Next;
                    }
                    p.Next = qbody.Attributes;
                }
            }
        }
示例#2
0
        public async Task <ActionResult <Dummies> > PostDummies(Dummies dummies)
        {
            context.Dummies.Add(dummies);
            await context.SaveChangesAsync();

            // return CreatedAtAction("GetDummies", new { ID = Dummies.Id }, Dummies);
            return(CreatedAtAction("GetDummies", new { ID = dummies.Id }));
        }
示例#3
0
        public async Task <IActionResult> PutDummies(int id, Dummies dummies)
        {
            if (id != dummies.Id)
            {
                return(BadRequest());
            }

            context.Entry(dummies).State = EntityState.Modified;
            await context.SaveChangesAsync();

            return(NoContent());
        }
示例#4
0
        /// <summary>
        /// Removes the dummy.
        /// </summary>
        /// <param name="dummy">The dummy.</param>
        public virtual void RemoveDummy(IDummy dummy)
        {
            if (dummy == null)
            {
                ActiveLogger.LogMessage("Cant Remove Null dummy", LogLevel.RecoverableError);
                return;
            }
            bool resp = Dummies.Remove(dummy);

            if (!resp)
            {
                ActiveLogger.LogMessage("Dummy not found: " + dummy.Name, LogLevel.Warning);
            }
        }
示例#5
0
        /// <summary>
        /// Add a Dummy to the world
        /// Its like a position,
        /// usefull to serializable position from a world editor
        /// </summary>
        /// <param name="dummy">The dummy.</param>
        public virtual void AddDummy(IDummy dummy)
        {
            if (dummy == null)
            {
                ActiveLogger.LogMessage("Cant Add Null dummy", LogLevel.RecoverableError);
                return;
            }

            if (String.IsNullOrEmpty(dummy.Name))
            {
                ActiveLogger.LogMessage("Dummy with no Name", LogLevel.Warning);
            }
            Dummies.Add(dummy);
        }
示例#6
0
        public async void SavePersonAsync_with_valid_id_should_return_a_Person()
        {
            // Setup
            Guid personId = Guid.NewGuid();

            _savePersonComponent.Setup(x => x.SavePersonAsync(It.IsAny <Library.Entities.Person>())).Returns(Task.FromResult(Dummies.GetDummiePerson(DummieInstance.ValidInstance)));

            // Act
            var result = await _savePersonComponent.Object.SavePersonAsync(Dummies.GetDummiePerson(DummieInstance.ValidInstance));

            var expectedType = typeof(Library.Entities.Person); // TODO: Should be a Task return
            var actualType   = result.GetType();

            //Assert
            Assert.True(expectedType.Equals(actualType));
        }
        public async Task SavePersonAsync_Should_Return_OkObjectResult_when_save_successfull()
        {
            //Setup
            _savePersonComponent.Setup(x => x.SavePersonAsync(It.IsAny <Person>())).Returns(Task.FromResult(Dummies.GetDummiePerson(DummieInstance.NewInstance)));
            _getPersonComponent.Setup(x => x.GetPersonByIdAsync(It.IsAny <Guid>())).Returns(Task.FromResult(Dummies.GetDummiePerson(DummieInstance.NewInstance)));
            //Act
            var result = await personController.SavePersonAsync(Dummies.GetDummiePersonModel(DummieInstance.NewInstance));

            var expectedType = new OkObjectResult(result).GetType();
            var actualType   = result.GetType();

            //Assert
            Assert.True(expectedType.Equals(actualType));
            //Check if the execute was called at least once on the controller method
            _savePersonComponent.Verify(x => x.SavePersonAsync(It.IsAny <Person>()), Times.Once);
            _getPersonComponent.Verify(x => x.GetPersonByIdAsync(It.IsAny <Guid>()), Times.Once);
        }
示例#8
0
        /// <summary>
        /// Cleans up.
        /// </summary>
        public virtual void CleanUp()
        {
            Camera2D.CleanUp();

            foreach (var item in Objects.ToArray())
            {
                this.RemoveObject(item);
            }

            if (CleanUpObjectsOnDispose)
            {
                foreach (var item in Objects)
                {
                    item.CleanUp(graphicsFactory);
                }
            }



            foreach (var item in SoundEmiters2D.ToArray())
            {
                this.RemoveSoundEmitter(item);
            }


            foreach (var item in SoundEmiters2D)
            {
                item.CleanUp(graphicsFactory);
            }

            Objects.Clear();
            Camera2D = null;
            Dummies.Clear();
            SoundEmiters2D.Clear();
            particleManager = null;
            PhysicWorld     = null;
            this.culler     = null;
        }
        public async Task GetPersonsAsync_Should_return_OkObjectResult_when_records_found()
        {
            //Setup
            _getPersonComponent.Setup(x => x.GetAllPersonsAsync()).Returns(Task.FromResult(Dummies.GetPeronList(DummieInstance.ValidInstance)));

            //Act
            var result = await personController.GetPersonsAsync();

            var expectedType = new OkObjectResult(result).GetType();
            var actualType   = result.GetType();

            //Assert
            Assert.True(expectedType.Equals(actualType));
            //Check if the execute was called at least once on the controller method
            _getPersonComponent.Verify(x => x.GetAllPersonsAsync(), Times.Once);
        }
        public async Task GetPersonByIdAsync_Should_return_StatusCodeResult_204_when_no_person_found()
        {
            // Setup
            Guid personId = Guid.NewGuid();

            _getPersonComponent.Setup(x => x.GetPersonByIdAsync(It.IsAny <Guid>())).Returns(Task.FromResult(Dummies.GetDummiePerson(Dummies.DummieInstance.NullObject)));

            // Act
            var result = await personController.GetPersonByIdAsync(personId);

            var expectedType = new StatusCodeResult(204).GetType();
            var actualType   = result.GetType();

            //Assert
            Assert.True(expectedType.Equals(actualType));
            //Check if the execute was called at least once on the controller method
            _getPersonComponent.Verify(x => x.GetPersonByIdAsync(personId), Times.Once);
        }
示例#11
0
        /// <summary>
        /// Cleans up.
        /// </summary>
        public virtual void CleanUp()
        {
            foreach (var item in this.CameraManager.GetCamerasDescription())
            {
                item.cam.CleanUp();
            }

            foreach (var item in SoundEmiters3D.ToArray())
            {
                this.RemoveSoundEmitter(item);
            }

            foreach (var item in Triggers.ToArray())
            {
                this.RemoveTrigger(item);
            }

            foreach (var item in Lights.ToArray())
            {
                this.RemoveLight(item);
            }


            if (CleanUpObjectsOnDispose)
            {
                foreach (var item in Objects.ToArray())
                {
                    this.RemoveObject(item);
                    item.CleanUp(graphicFactory);
                }
            }
            else
            {
                foreach (var item in Objects.ToArray())
                {
                    this.RemoveObject(item);
                }
            }



            foreach (var item in SoundEmiters3D)
            {
                item.CleanUp(graphicFactory);
            }

            Objects.Clear();
            Lights.Clear();
            Dummies.Clear();
            this.culler = null;
            SoundEmiters3D.Clear();
            CameraManager = null;
            Triggers.Clear();
            if (particleManager != null)
            {
                particleManager.iCleanUp();
                particleManager = null;
            }
            this.PhysicWorld.iCleanUp();
            this.PhysicWorld = null;
        }
示例#12
0
        public async void GetAllPersonsAsync_should_return_a_List_of_Persons()
        {
            // Setup
            Guid personId = Guid.NewGuid();

            _getPersonComponent.Setup(x => x.GetAllPersonsAsync()).Returns(Task.FromResult(Dummies.GetPeronList(DummieInstance.ValidInstance)));

            // Act
            var result = await _getPersonComponent.Object.GetAllPersonsAsync();

            var expectedType = typeof(List <Library.Entities.Person>); // TODO: Should be a Task return
            var actualType   = result.GetType();

            //Assert
            Assert.True(expectedType.Equals(actualType));
        }