示例#1
0
        public async Task TestPutAsync()
        {
            var         controller  = TestServerProvider.CreateController <UsageRecordsController>();
            UsageRecord usageRecord = new()
            {
                User        = Guid.NewGuid().ToString(),
                TestNo      = "Test123",
                TestType    = "TY",
                ProjectNo   = "1394P.000001",
                EquipmentNo = "01-01",
                StartTime   = DateTimeOffset.Now,
                EndTime     = DateTimeOffset.Now.AddHours(6)
            };
            await controller.PostAsync(usageRecord);

            var usageRecords = controller.Get();

            usageRecord.Id   = usageRecords.First(item => item.User == usageRecord.User).Id;
            usageRecord.User = Guid.NewGuid().ToString();
            await controller.PutAsync(usageRecord);

            var usageRecordsAfterPut = controller.Get();

            Assert.Contains(usageRecordsAfterPut, item => item.User == usageRecord.User);
            await controller.DeleteById(usageRecord.Id);
        }
    }
示例#2
0
        public void TestGet()
        {
            var controller = TestServerProvider.CreateController <EquipmentHourlyRatesController>();

            foreach (var equipmentHourlyRate in controller.Get())
            {
                Assert.NotNull(equipmentHourlyRate);
            }
        }
示例#3
0
        public void TestGet()
        {
            var controller = TestServerProvider.CreateController <UsageRecordsController>();

            foreach (UsageRecord usageRecord in controller.Get())
            {
                Assert.NotNull(usageRecord);
            }
        }
示例#4
0
        public void TestGetActive()
        {
            var controller = TestServerProvider
                             .CreateController <ProjectsController>();

            foreach (Project project in controller.Get())
            {
                Assert.NotNull(project);
            }
        }
        public void TestGet()
        {
            var controller = TestServerProvider.CreateController <ExcelExportController>();
            var fileResult = controller.Get() as FileStreamResult;

            Assert.NotNull(fileResult);
            using ExcelEngine excelEngine = new();
            IApplication app = excelEngine.Excel;

            app.DefaultVersion = ExcelVersion.Xlsx;
            Assert.NotNull(app.Workbooks.Open(fileResult !.FileStream));
        }