Commit b575a1ca authored by Adrian Ramcharitar's avatar Adrian Ramcharitar

Added more test cases

parent fb65eb77
Pipeline #56879318 passed with stages
in 7 minutes and 20 seconds
......@@ -233,7 +233,7 @@ namespace Foci.Orbital.Agent.Tests.Services
/// Test passing null service ID to BootStrapSubscriberDetails method
/// </summary>
[Fact]
[Trait("Category", "Failure")]
[Trait("Category", "Success")]
public void BootStrapSubscriberDetailsNullServiceID()
{
#region Substitutions
......@@ -279,8 +279,49 @@ namespace Foci.Orbital.Agent.Tests.Services
[Fact]
[Trait("Category", "Failure")]
public void operationHnadlerFailed()
public void BootStrapServiceDetailsNull()
{
#region Substitutions
IConfigurationService subConfiguration = Substitute.For<IConfigurationService>();
IBusService subBusService = Substitute.For<IBusService>();
IOperationsHandler subOperationsHandler = Substitute.For<IOperationsHandler>();
IServiceDefinitionRepository serviceDefinitionRepository = Substitute.For<IServiceDefinitionRepository>();
IBus subBus = Substitute.For<IBus>();
#endregion
#region Setup
var Input = new
{
RabbitConfiguration = new Faker<BrokerConfiguration>()
.RuleFor(r => r.SslEnabled, f => true)
.RuleFor(r => r.Password, f => f.Internet.Password())
.RuleFor(r => r.Username, f => f.Internet.UserName())
.RuleFor(r => r.BusHostIp, f => f.Internet.Ip())
.RuleFor(r => r.BusHostPort, f => f.Random.Int(1, 65535))
.Generate(),
ServiceId = "testid",
Details = new List<SubscriberDetails>()
{
SubscriberDetails.Create<string>(s => string.IsNullOrEmpty(s), string.Empty),
SubscriberDetails.Create<string, string>(s => s,string.Empty)
}
};
var config = new OrbitalConfiguration
{
BrokerConfiguration = Input.RabbitConfiguration
};
subConfiguration.GetConfigurationProperties().Returns(config);
subBusService.BootstrapService(Arg.Any<BusConnectionDetails>(), Arg.Any<SubscriberDetails[]>()).Returns(subBus);
#endregion
var Target = new ServiceDefinitionService(subConfiguration, subBusService, serviceDefinitionRepository, subOperationsHandler);
var Expected = subBus;
var Actual = Target.BootStrapSubscriberDetails(Input.ServiceId, null);
Assert.Equal(Expected, Actual);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment