//api/machinetype/{type} onde type é o id de um tipo de maquina public async Task <ActionResult <MachineDTO> > GetMachineByMachineType(Guid type) { try { var machines = await _serviceMachine.GetMachineByType(type); return(CreatedAtAction("GetMachineByMachineType", _mapper.Map <List <Machine>, List <MachineDTO> >(machines))); } catch (NullReferenceException e) { return(NotFound(e.Message)); } }
public async void EnsureMachineIsFoundByMachineType() { var context = ContextMocker.GetContextMock(); ContextMocker.SeedMachines(context); var machineService = new MachineService(context); List <Machine> result = await machineService.GetMachineByType(new Guid("21111111-1111-1111-1111-111111111111")); foreach (Machine m in result) { if (m.MachineType.Id.Equals(new Guid("21111111-1111-1111-1111-111111111111"))) { Assert.True(/* expectedMachineModel.Equals(result.MachineModel.Model) */ result.Contains(m)); } } }