public async Task A130_PowerSourceChangeSubscriber_NotFound() { await EventSubscriberTester.Create <Startup>() .ExpectResult(SubscriberStatus.DataNotFound) .RunAsync <PowerSourceChangeSubscriber>(EventData.CreateValueEvent(new PowerSourceChangeData { RobotId = 404.ToGuid(), PowerSource = "N" }, $"Demo.Robot.{404.ToGuid()}", "PowerSourceChange")); }
public async Task A140_PowerSourceChangeSubscriber_InvalidData_Value() { await EventSubscriberTester.Create <Startup>() .ExpectResult(SubscriberStatus.InvalidData) .RunAsync <PowerSourceChangeSubscriber>(EventData.CreateValueEvent(new PowerSourceChangeData { RobotId = 1.ToGuid(), PowerSource = "!" }, $"Demo.Robot.{1.ToGuid()}", "PowerSourceChange")); }
public async Task A150_PowerSourceChangeSubscriber_ManagerFailure() { var rm = new Mock <IRobotManager>(); rm.Setup(x => x.GetAsync(1.ToGuid())).Throws(new InvalidOperationException("Get method failed!")); await EventSubscriberTester.Create <Startup>() .ExpectUnhandledException <InvalidOperationException>("*") .AddScopedService(rm.Object) .RunAsync <PowerSourceChangeSubscriber>(EventData.CreateValueEvent(new PowerSourceChangeData { RobotId = 1.ToGuid(), PowerSource = "N" }, $"Demo.Robot.{1.ToGuid()}", "PowerSourceChange")); }
public void A110_PowerSourceChangeSubscriber_NoUpdated() { var r = AgentTester.Create <RobotAgent, Robot>() .ExpectStatusCode(HttpStatusCode.OK) .Run(a => a.Agent.GetAsync(1.ToGuid())).Value; EventSubscriberTester.Create <PowerSourceChangeSubscriber>() .ExpectResult(SubscriberStatus.Success) .ExpectNoEvents() .Run(EventData.CreateValueEvent(r.PowerSourceSid, $"Demo.Robot.{r.Id}", "PowerSourceChange", r.Id)); AgentTester.Create <RobotAgent, Robot>() .ExpectStatusCode(HttpStatusCode.OK) .ExpectValue(_ => r) .Run(a => a.Agent.GetAsync(1.ToGuid())); }
public async Task A110_PowerSourceChangeSubscriber_NoUpdated() { var r = (await AgentTester.Test <RobotAgent, Robot>() .ExpectStatusCode(HttpStatusCode.OK) .RunAsync(a => a.GetAsync(1.ToGuid()))).Value; await EventSubscriberTester.Create <Startup>() .ExpectResult(SubscriberStatus.Success) .ExpectNoEvents() .RunAsync <PowerSourceChangeSubscriber>(EventData.CreateValueEvent(new PowerSourceChangeData { RobotId = r.Id, PowerSource = r.PowerSourceSid }, $"Demo.Robot.{r.Id}", "PowerSourceChange")); await AgentTester.Test <RobotAgent, Robot>() .ExpectStatusCode(HttpStatusCode.OK) .ExpectValue(_ => r) .RunAsync(a => a.GetAsync(1.ToGuid())); }
public void A150_PowerSourceChangeSubscriber_InvalidData_Value() { EventSubscriberTester.Create <PowerSourceChangeSubscriber>() .ExpectResult(SubscriberStatus.InvalidData) .Run(EventData.CreateValueEvent("!", $"Demo.Robot.{1.ToGuid()}", "PowerSourceChange", 1.ToGuid())); }
public void A140_PowerSourceChangeSubscriber_InvalidData_Key() { EventSubscriberTester.Create <PowerSourceChangeSubscriber>() .ExpectResult(SubscriberStatus.InvalidData) .Run(EventData.CreateValueEvent("N", $"Demo.Robot.Xyz", "PowerSourceChange", "Xyz")); }
public void A130_PowerSourceChangeSubscriber_NotFound() { EventSubscriberTester.Create <PowerSourceChangeSubscriber>() .ExpectResult(SubscriberStatus.DataNotFound) .Run(EventData.CreateValueEvent("N", $"Demo.Robot.{404.ToGuid()}", "PowerSourceChange", 404.ToGuid())); }