如何解决测试自动化 C# - RestSharp API - 断言 2 图像签名
我希望能够通过 GET 调用来获取图像。然后我想将该图像与我保存在文件夹中的图像进行比较
两张图片是签名
到目前为止我的代码是:
client = new RestClient(ConfigurationHelper.GetValue("BaseURL"));
client.Authenticator = new NtlmAuthenticator((Domain + @"\" + User),Password);
request = new RestRequest(EndPoint,Method.GET);
byte[] restResponse = client.DownloadData(request);
File.WriteAllBytes(Path.Combine(CommonHelper.AssemblyDirectory,$@"Folder" + User),restResponse);
这非常有效,因为我获取图像并将其写入某个位置。现在我想将此图像与另一幅图像进行比较。是否有捷径可寻?或者我可以使用的 NuGet 包?
我尝试过这样做,但卡住了
FileInfo fi1 = new FileInfo(@"C:\Location where file from API is stored");
DirectoryInfo di1 = fi1.Directory;
FileInfo[] actualDGImage = di1.GetFiles(User);
FileInfo fi = new FileInfo(@"C:\Location where expected file is saved");
DirectoryInfo di = fi.Directory;
FileInfo[] expectedDGImage = di.GetFiles(User + ".png");
不过好像不能这样断言?
我已经看到一些使用 Sikuli 的解决方案,但找不到适合我的情况的任何解决方案。与浏览器中的图像进行比较的大多数解决方案
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。