public void TestAddingDatagrid() { var testFloorplan = DbDataGenerator.AddFloorPlanToDatabase(_testBlueprint.Id); var request = new FloorPlanRequestDto.FloorplanAddImage { FloorplanId = testFloorplan.Id, Image = Convert.ToBase64String(RandomGenerator.BitmapBytes()) }; var response = _client.Post(request); Assert.IsTrue(response.Result); var data = _client.Get(new FloorPlanRequestDto.GetFloorPlanDataGrid {FloorplanId = testFloorplan.Id}); Assert.IsNotNull(data.DataPath); }
private static void AddCalibImage(JsonServiceClient client) { var floorplans = new List<FloorPlan>(); using (var uow = new BlueprintUnitOfWork()) { floorplans = uow.FloorPlans.Where(f => f.BluePrintId == 1).ToList(); } for (int i = 1; i <= 3; i++) { var path = string.Format(Laptop, i); Console.WriteLine("Path is " + path); var image = Image.FromFile(path); var dto = new FloorPlanRequestDto.FloorplanAddImage { FloorplanId = floorplans.FirstOrDefault(f => f.Floor == (i - 1)).Id, Image = Convert.ToBase64String(image.ImageToByteArray()) }; Console.WriteLine("Send request..."); var resp = client.Post(dto); Console.WriteLine(resp.Message); } Console.WriteLine("done"); Console.ReadLine(); }