public void Helper_Minio_GetMinioClient() { //Arrange //Act var result = MH.GetMinioClient() as MinioClient; //Assert Assert.IsNotNull(result); }
public void Helper_Minio_GetMinioObjectPresignedUrl() { //Arrange string bucketName = "product-category"; string objectName = "All-Art.jpg"; string expectedUrl = "http://localhost:9000/product-category/All-Art.jpg?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=MinioServer%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date="; //Act var result = MH.GetMinioObject(bucketName, objectName) as Task <string>; //Get the substring from the result removing the date and amazon signed signatures as it varies every time var subString = result.Result.Split('=')[0] + "=" + result.Result.Split('=')[1] + "=" + (result.Result.Split('=')[2]).Split('%')[0] + "%" + (result.Result.Split('=')[2]).Split('%')[2] + "%" + (result.Result.Split('=')[2]).Split('%')[3] + "%" + result.Result.Split('=')[2].Substring(result.Result.Split('=')[2].LastIndexOf('%') + 1) + "="; //Assert Assert.IsNotNull(result); Assert.AreEqual(expectedUrl, subString); }