refactors
This commit is contained in:
@@ -7,21 +7,28 @@ namespace Jibo.Cloud.Tests.Protocol;
|
||||
|
||||
public sealed class FileProtocolTelemetrySinkTests : IDisposable
|
||||
{
|
||||
private readonly string _workspaceRoot;
|
||||
private readonly string _repoRoot;
|
||||
private readonly string _appBaseDirectory;
|
||||
private readonly string _repoRoot;
|
||||
private readonly string _workspaceRoot;
|
||||
|
||||
public FileProtocolTelemetrySinkTests()
|
||||
{
|
||||
_workspaceRoot = Path.Combine(Path.GetTempPath(), "OpenJibo.ProtocolTelemetry.Tests", Guid.NewGuid().ToString("N"));
|
||||
_workspaceRoot = Path.Combine(Path.GetTempPath(), "OpenJibo.ProtocolTelemetry.Tests",
|
||||
Guid.NewGuid().ToString("N"));
|
||||
_repoRoot = Path.Combine(_workspaceRoot, "OpenJibo");
|
||||
_appBaseDirectory = Path.Combine(_repoRoot, "src", "Jibo.Cloud", "dotnet", "src", "Jibo.Cloud.Api", "bin", "Debug", "net10.0");
|
||||
_appBaseDirectory = Path.Combine(_repoRoot, "src", "Jibo.Cloud", "dotnet", "src", "Jibo.Cloud.Api", "bin",
|
||||
"Debug", "net10.0");
|
||||
|
||||
Directory.CreateDirectory(_repoRoot);
|
||||
Directory.CreateDirectory(_appBaseDirectory);
|
||||
File.WriteAllText(Path.Combine(_repoRoot, "OpenJibo.slnx"), string.Empty);
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
if (Directory.Exists(_workspaceRoot)) Directory.Delete(_workspaceRoot, true);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task RecordAsync_ResolvesRelativePathAgainstOpenJiboRepoRoot()
|
||||
{
|
||||
@@ -52,12 +59,4 @@ public sealed class FileProtocolTelemetrySinkTests : IDisposable
|
||||
Assert.Contains("Notification_20150505", contents);
|
||||
Assert.DoesNotContain(Path.Combine("bin", "Debug"), captureFile, StringComparison.OrdinalIgnoreCase);
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
if (Directory.Exists(_workspaceRoot))
|
||||
{
|
||||
Directory.Delete(_workspaceRoot, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -144,10 +144,7 @@ public sealed class JiboCloudProtocolServiceTests
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (File.Exists(persistencePath))
|
||||
{
|
||||
File.Delete(persistencePath);
|
||||
}
|
||||
if (File.Exists(persistencePath)) File.Delete(persistencePath);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -170,7 +167,8 @@ public sealed class JiboCloudProtocolServiceTests
|
||||
});
|
||||
|
||||
using var createdPayload = JsonDocument.Parse(result.BodyText);
|
||||
Assert.Equal("https://api.jibo.com/media/photo-blob-1", createdPayload.RootElement.GetProperty("url").GetString());
|
||||
Assert.Equal("https://api.jibo.com/media/photo-blob-1",
|
||||
createdPayload.RootElement.GetProperty("url").GetString());
|
||||
|
||||
var mediaGet = await _service.DispatchAsync(new ProtocolEnvelope
|
||||
{
|
||||
@@ -226,7 +224,10 @@ public sealed class JiboCloudProtocolServiceTests
|
||||
|
||||
Assert.NotEmpty(people);
|
||||
Assert.Contains(people, person => person.IsPrimary);
|
||||
Assert.Contains(people, person => string.Equals(person.AccountId, store.GetAccount().AccountId, StringComparison.OrdinalIgnoreCase));
|
||||
Assert.Contains(people, person => string.Equals(person.LoopId, store.GetLoops()[0].LoopId, StringComparison.OrdinalIgnoreCase));
|
||||
Assert.Contains(people,
|
||||
person => string.Equals(person.AccountId, store.GetAccount().AccountId,
|
||||
StringComparison.OrdinalIgnoreCase));
|
||||
Assert.Contains(people,
|
||||
person => string.Equals(person.LoopId, store.GetLoops()[0].LoopId, StringComparison.OrdinalIgnoreCase));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -19,4 +19,4 @@ public sealed class ProtocolFixtureReplayTests
|
||||
Assert.Equal(fixture.ExpectedStatusCode, result.StatusCode);
|
||||
Assert.False(string.IsNullOrWhiteSpace(result.BodyText));
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user