示例#1
0
        public async void ByMachinePolicyId_Not_Exists()
        {
            var mock = new ServiceMockFacade <IMachineRepository>();

            mock.RepositoryMock.Setup(x => x.ByMachinePolicyId(It.IsAny <string>())).Returns(Task.FromResult <List <Machine> >(new List <Machine>()));
            var service = new MachineService(mock.LoggerMock.Object,
                                             mock.RepositoryMock.Object,
                                             mock.ModelValidatorMockFactory.MachineModelValidatorMock.Object,
                                             mock.BOLMapperMockFactory.BOLMachineMapperMock,
                                             mock.DALMapperMockFactory.DALMachineMapperMock);

            List <ApiMachineResponseModel> response = await service.ByMachinePolicyId(default(string));

            response.Should().BeEmpty();
            mock.RepositoryMock.Verify(x => x.ByMachinePolicyId(It.IsAny <string>()));
        }