public void EquipmentTypeManager_DeleteEquipmentType_Equipment_Values()
        {
            var saveTask = Task <EquipmentType> .Factory.StartNew(() => { return(new EquipmentType()); });

            var equipmentSave = Task <Equipment> .Factory.StartNew(() => { return(new Equipment()); });

            EquipmentTypeAccessor.Arrange(x => x.GetEquipmentType(Arg.IsAny <long>()))
            .Returns(Task.FromResult(new EquipmentType()))
            .OccursOnce();
            EquipmentTypeAccessor.Arrange(x => x.SaveEquipmentType(Arg.IsAny <EquipmentType>()))
            .Returns(saveTask)
            .OccursOnce();
            EquipmentAccessor.Arrange(x => x.GetEquipmentByType(Arg.IsAny <long>()))
            .Returns(Task.FromResult(new List <Equipment> {
                new Equipment {
                    EquipmentTypeId = 5
                }, new Equipment()
            }.AsEnumerable()))
            .OccursOnce();
            EquipmentAccessor.Arrange(x => x.SaveEquipment(Arg.Matches <Equipment>(y => y.EquipmentTypeId == 1)))
            .Returns(equipmentSave)
            .Occurs(2);



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

            saveTask.Wait();
            equipmentSave.Wait();
            EquipmentTypeAccessor.Assert();
            EquipmentAccessor.Assert();
            Assert.IsNotNull(res);
            Assert.IsTrue(res);
        }
        public void EquipmentTypeManager_GetEquipmentTypes()
        {
            EquipmentTypeAccessor.Arrange(x => x.GetEquipmentTypes())
            .Returns(Task.FromResult(new List <EquipmentType>().AsEnumerable()))
            .OccursOnce();

            var res = manager.GetEquipmentTypes().Result;

            EquipmentTypeAccessor.Assert();
            Assert.IsNotNull(res);
            Assert.AreEqual(typeof(List <EquipmentType>), res.GetType());
        }
        public void EquipmentTypeManager_SaveEquipmentType()
        {
            EquipmentTypeAccessor.Arrange(x => x.SaveEquipmentType(Arg.IsAny <EquipmentType>()))
            .Returns(Task.FromResult(new EquipmentType()))
            .OccursOnce();

            var res = manager.SaveEquipmentType(new EquipmentType()).Result;

            EquipmentTypeAccessor.Assert();
            Assert.IsNotNull(res);
            Assert.AreEqual(typeof(EquipmentType), res.GetType());
        }
        public void EquipmentTypeManager_SaveEquipmentType_Values()
        {
            var equipmentType = new EquipmentType
            {
                Name    = "Type",
                Deleted = false
            };

            EquipmentTypeAccessor.Arrange(x => x.SaveEquipmentType(equipmentType))
            .Returns(Task.FromResult(equipmentType))
            .OccursOnce();

            var res = manager.SaveEquipmentType(equipmentType).Result;

            EquipmentTypeAccessor.Assert();
            Assert.IsNotNull(res);
            Assert.AreEqual(typeof(EquipmentType), res.GetType());
        }
        public void EquipmentTypeManager_DeleteEquipmentType_Error()
        {
            var saveTask = Task <EquipmentType> .Factory.StartNew(() => { return(new EquipmentType()); });

            EquipmentTypeAccessor.Arrange(x => x.GetEquipmentType(Arg.IsAny <long>()))
            .Returns(Task.FromResult(new EquipmentType()))
            .OccursOnce();
            EquipmentTypeAccessor.Arrange(x => x.SaveEquipmentType(Arg.IsAny <EquipmentType>()))
            .Throws(new Exception())
            .OccursOnce();

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

            saveTask.Wait();
            EquipmentTypeAccessor.Assert();
            Assert.IsNotNull(res);
            Assert.IsFalse(res);
        }
        public void EquipmentTypeManager_DeleteEquipmentType()
        {
            var saveTask = Task <EquipmentType> .Factory.StartNew(() => { return(new EquipmentType()); });

            EquipmentTypeAccessor.Arrange(x => x.GetEquipmentType(Arg.IsAny <long>()))
            .Returns(Task.FromResult(new EquipmentType()))
            .OccursOnce();
            EquipmentTypeAccessor.Arrange(x => x.SaveEquipmentType(Arg.IsAny <EquipmentType>()))
            .Returns(saveTask)
            .OccursOnce();
            EquipmentAccessor.Arrange(x => x.GetEquipmentByType(Arg.IsAny <long>()))
            .Returns(Task.FromResult(new List <Equipment>().AsEnumerable()))
            .OccursOnce();


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

            saveTask.Wait();
            EquipmentTypeAccessor.Assert();
            EquipmentAccessor.Assert();
            Assert.IsNotNull(res);
            Assert.IsTrue(res);
        }