Example #1
0
        public void EndOpenLogFile_Is_Published()
        {
            var sut = new Server.Hubs.RuntimeHub(_eventBus, _clientHealthService, _groupMembershipService, A.Dummy<IHubContext<Server.Hubs.IRuntimeClient>>());
            sut.Context = new HubCallerContext(_request, Guid.NewGuid().ToString().ToLower());
            var completed = DomainModel.Response<byte[]>.Success("SOMETOKEN", new byte[10]);

            sut.EndOpenLogFile(completed);

            A.CallTo(() => _eventBus.Publish(A<object>.That.IsSameAs(completed), A<string>.That.IsEqualTo(completed.Token))).MustHaveHappened(Repeated.Exactly.Once);
        }
Example #2
0
        public async Task GroupMembershipService_Leave_Called_With_OnDisconnected_Async()
        {
            A.CallTo(() => _groupMembershipService.Join(A<IHubContext<Server.Hubs.IRuntimeClient>>.Ignored, A<ClaimsPrincipal>.Ignored, A<string>.Ignored, A<Task>.Ignored))
                .Returns(Task.FromResult<object>(null));
            var sut = new Server.Hubs.RuntimeHub(_eventBus, _clientHealthService, _groupMembershipService, A.Dummy<IHubContext<Server.Hubs.IRuntimeClient>>());
            sut.Context = new HubCallerContext(_request, Guid.NewGuid().ToString().ToLower());

            await sut.OnDisconnected(true);

            A.CallTo(() => _groupMembershipService.Leave(A<IHubContext<Server.Hubs.IRuntimeClient>>.Ignored, A<ClaimsPrincipal>.Ignored, A<string>.Ignored, A<Task>.Ignored))
                .MustHaveHappened(Repeated.Exactly.Once);
        }
Example #3
0
        public void Client_Can_Report_Health_Async()
        {
            var sut = new Server.Hubs.RuntimeHub(_eventBus, _clientHealthService, _groupMembershipService, A.Dummy<IHubContext<Server.Hubs.IRuntimeClient>>());
            sut.Context = new HubCallerContext(_request, Guid.NewGuid().ToString().ToLower());
            var healthInfo = new DomainModel.EnvironmentInfo();

            sut.ReportHealth(healthInfo);

            A.CallTo(() => _clientHealthService.RecordHealthAsync(A<ClaimsPrincipal>.Ignored, A<DomainModel.EnvironmentInfo>.That.IsSameAs(healthInfo)))
                .MustHaveHappened(Repeated.Exactly.Once);
        }