public void Should_Success_Validate_All_Null_ObjectProperty3()
        {
            var dbContext           = GetDbContext(GetCurrentMethod());
            var serviceProviderMock = GetServiceProviderMock();
            var service             = new VbNonPORequestService(dbContext, serviceProviderMock.Object);
            var dataUtil            = new VbNonPORequestDataUtil(service);
            var viewModel           = dataUtil.GetViewModelToValidateOthers3();

            Assert.True(viewModel.Validate(null).Count() > 0);
        }
        public async Task Should_ThrowsException_UpdateStatusAsync()
        {
            var dbContext           = GetDbContext(GetCurrentMethod());
            var serviceProviderMock = GetServiceProviderMock();
            var service             = new VbNonPORequestService(dbContext, serviceProviderMock.Object);
            var dataUtil            = new VbNonPORequestDataUtil(service);


            await Assert.ThrowsAsync <Exception>(() => service.UpdateStatusAsync(null, "user"));
        }
        public async Task Should_Success_ReadWithDateFilter_Data()
        {
            var dbContext           = GetDbContext(GetCurrentMethod());
            var serviceProviderMock = GetServiceProviderMock();
            var service             = new VbNonPORequestService(dbContext, serviceProviderMock.Object);
            var dataUtil            = new VbNonPORequestDataUtil(service);
            await dataUtil.GetCreatedData();

            var result = service.ReadWithDateFilter(DateTimeOffset.Now, 7, 1, 10, "{}", new List <string>(), "", "{}");

            Assert.NotNull(result.Data);
        }
        public async Task Should_Success_Delete_ById()
        {
            var dbContext           = GetDbContext(GetCurrentMethod());
            var serviceProviderMock = GetServiceProviderMock();
            var service             = new VbNonPORequestService(dbContext, serviceProviderMock.Object);
            var dataUtil            = new VbNonPORequestDataUtil(service);
            var data = await dataUtil.GetCreatedData();

            var result = await service.DeleteAsync(data.Id);

            Assert.NotEqual(0, result);
        }
        public async Task Should_Success_MapToViewModel()
        {
            var dbContext           = GetDbContext(GetCurrentMethod());
            var serviceProviderMock = GetServiceProviderMock();
            var service             = new VbNonPORequestService(dbContext, serviceProviderMock.Object);
            var dataUtil            = new VbNonPORequestDataUtil(service);
            var data = await dataUtil.GetCreatedData();

            var result = await service.ReadByIdAsync(data.Id);

            Assert.NotNull(result);
        }
        public async Task Should_Success_Create_Model()
        {
            var dbContext           = GetDbContext(GetCurrentMethod());
            var serviceProviderMock = GetServiceProviderMock();
            var service             = new VbNonPORequestService(dbContext, serviceProviderMock.Object);
            var dataUtil            = new VbNonPORequestDataUtil(service);
            var modelToCreate       = dataUtil.GetVbRequestModelToCreate();
            var viewmodelToCreate   = dataUtil.GetViewModel();
            var result = await service.CreateAsync(modelToCreate, viewmodelToCreate);

            Assert.NotEqual(0, result);
        }
        public async Task Should_Success_UpdateStatusAsync()
        {
            var dbContext           = GetDbContext(GetCurrentMethod());
            var serviceProviderMock = GetServiceProviderMock();
            var service             = new VbNonPORequestService(dbContext, serviceProviderMock.Object);
            var dataUtil            = new VbNonPORequestDataUtil(service);

            List <VbRequestModel> modelList = new List <VbRequestModel>();
            VbRequestModel        model     = await dataUtil.GetTestData();

            modelList.Add(model);

            var result = await service.UpdateStatusAsync(modelList, "user");

            Assert.NotEqual(1, result);
        }
Exemple #8
0
 public VbNonPORequestDataUtil(VbNonPORequestService service)
 {
     _service = service;
 }
 private VbNonPORequestDataUtil _dataUtil3(VbNonPORequestService service)
 {
     return(new VbNonPORequestDataUtil(service));
 }