Esempio n. 1
0
        public async void TestGet()
        {
            var builder = new WebHostBuilder()
                          .UseEnvironment("Production")
                          .UseStartup <TestStartup>();
            TestServer testServer = new TestServer(builder);

            var client = new ApiClient(testServer.CreateClient());
            ApiShiftResponseModel response = await client.ShiftGetAsync(1);

            response.Should().NotBeNull();
        }
Esempio n. 2
0
        public async void ByStartTimeEndTime_Not_Exists()
        {
            var mock = new ServiceMockFacade <IShiftRepository>();

            mock.RepositoryMock.Setup(x => x.ByStartTimeEndTime(It.IsAny <TimeSpan>(), It.IsAny <TimeSpan>())).Returns(Task.FromResult <Shift>(null));
            var service = new ShiftService(mock.LoggerMock.Object,
                                           mock.RepositoryMock.Object,
                                           mock.ModelValidatorMockFactory.ShiftModelValidatorMock.Object,
                                           mock.BOLMapperMockFactory.BOLShiftMapperMock,
                                           mock.DALMapperMockFactory.DALShiftMapperMock,
                                           mock.BOLMapperMockFactory.BOLEmployeeDepartmentHistoryMapperMock,
                                           mock.DALMapperMockFactory.DALEmployeeDepartmentHistoryMapperMock);

            ApiShiftResponseModel response = await service.ByStartTimeEndTime(default(TimeSpan), default(TimeSpan));

            response.Should().BeNull();
            mock.RepositoryMock.Verify(x => x.ByStartTimeEndTime(It.IsAny <TimeSpan>(), It.IsAny <TimeSpan>()));
        }
Esempio n. 3
0
        public async void Get_null_record()
        {
            var mock = new ServiceMockFacade <IShiftRepository>();

            mock.RepositoryMock.Setup(x => x.Get(It.IsAny <int>())).Returns(Task.FromResult <Shift>(null));
            var service = new ShiftService(mock.LoggerMock.Object,
                                           mock.RepositoryMock.Object,
                                           mock.ModelValidatorMockFactory.ShiftModelValidatorMock.Object,
                                           mock.BOLMapperMockFactory.BOLShiftMapperMock,
                                           mock.DALMapperMockFactory.DALShiftMapperMock,
                                           mock.BOLMapperMockFactory.BOLEmployeeDepartmentHistoryMapperMock,
                                           mock.DALMapperMockFactory.DALEmployeeDepartmentHistoryMapperMock);

            ApiShiftResponseModel response = await service.Get(default(int));

            response.Should().BeNull();
            mock.RepositoryMock.Verify(x => x.Get(It.IsAny <int>()));
        }
Esempio n. 4
0
        public async void ByName_Exists()
        {
            var mock   = new ServiceMockFacade <IShiftRepository>();
            var record = new Shift();

            mock.RepositoryMock.Setup(x => x.ByName(It.IsAny <string>())).Returns(Task.FromResult(record));
            var service = new ShiftService(mock.LoggerMock.Object,
                                           mock.RepositoryMock.Object,
                                           mock.ModelValidatorMockFactory.ShiftModelValidatorMock.Object,
                                           mock.BOLMapperMockFactory.BOLShiftMapperMock,
                                           mock.DALMapperMockFactory.DALShiftMapperMock,
                                           mock.BOLMapperMockFactory.BOLEmployeeDepartmentHistoryMapperMock,
                                           mock.DALMapperMockFactory.DALEmployeeDepartmentHistoryMapperMock);

            ApiShiftResponseModel response = await service.ByName(default(string));

            response.Should().NotBeNull();
            mock.RepositoryMock.Verify(x => x.ByName(It.IsAny <string>()));
        }
        public async void TestGet()
        {
            ApiShiftResponseModel response = await this.Client.ShiftGetAsync(1);

            response.Should().NotBeNull();
        }