Exemple #1
0
        public void EquipmentManager_DeleteEquipment()
        {
            var saveTask = Task <Equipment> .Factory.StartNew(() => { return(new Equipment()); });

            EquipmentAccessor.Arrange(x => x.GetEquipment(Arg.IsAny <long>()))
            .Returns(Task.FromResult(new Equipment()))
            .OccursOnce();

            EquipmentAccessor.Arrange(x => x.SaveEquipment(Arg.IsAny <Equipment>()))
            .Returns(saveTask)
            .OccursOnce();

            var res = manager.DeleteEquipment(5).Result;

            saveTask.Wait();
            Assert.IsNotNull(res);
            Assert.IsTrue(res);
            EquipmentAccessor.Assert();
        }
        public async Task <ActionResult> DeleteEquipment(long equipmentId)
        {
            await EquipmentManager.DeleteEquipment(equipmentId);

            return(RedirectToAction("ManageEquipment"));
        }