mirror of
https://github.com/nsnail/Ocelot.git
synced 2025-06-18 23:58:14 +08:00
Feat/monorepo (#734)
* copied everything from repos back to ocelot repo * added src projects to sln * removed all test projects that have no tests * added all test projects to sln * removed test not on master * merged unit tests * merged acceptance tests * merged integration tests * fixed namepaces * build script creates packages for all projects * updated docs to make sure no references to external repos that we will remove * +semver: breaking
This commit is contained in:
@ -0,0 +1,52 @@
|
||||
namespace Ocelot.UnitTests.Rafty
|
||||
{
|
||||
using System.Threading.Tasks;
|
||||
using global::Rafty.Concensus.Node;
|
||||
using global::Rafty.Infrastructure;
|
||||
using Moq;
|
||||
using Ocelot.Configuration.File;
|
||||
using Provider.Rafty;
|
||||
using Shouldly;
|
||||
using Xunit;
|
||||
|
||||
public class RaftyFileConfigurationSetterTests
|
||||
{
|
||||
private readonly RaftyFileConfigurationSetter _setter;
|
||||
private readonly Mock<INode> _node;
|
||||
|
||||
public RaftyFileConfigurationSetterTests()
|
||||
{
|
||||
_node = new Mock<INode>();
|
||||
_setter = new RaftyFileConfigurationSetter(_node.Object);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task should_return_ok()
|
||||
{
|
||||
var fileConfig = new FileConfiguration();
|
||||
|
||||
var response = new OkResponse<UpdateFileConfiguration>(new UpdateFileConfiguration(fileConfig));
|
||||
|
||||
_node.Setup(x => x.Accept(It.IsAny<UpdateFileConfiguration>()))
|
||||
.ReturnsAsync(response);
|
||||
|
||||
var result = await _setter.Set(fileConfig);
|
||||
result.IsError.ShouldBeFalse();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task should_return_not_ok()
|
||||
{
|
||||
var fileConfig = new FileConfiguration();
|
||||
|
||||
var response = new ErrorResponse<UpdateFileConfiguration>("error", new UpdateFileConfiguration(fileConfig));
|
||||
|
||||
_node.Setup(x => x.Accept(It.IsAny<UpdateFileConfiguration>()))
|
||||
.ReturnsAsync(response);
|
||||
|
||||
var result = await _setter.Set(fileConfig);
|
||||
|
||||
result.IsError.ShouldBeTrue();
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user