예제 #1
0
        public async Task Should_Notice_Everyone_About_The_Users_Exit_When_Updating_The_Current_User_Room()
        {
            // arrage
            Guid   connectionUid         = Guid.NewGuid();
            string theRoomTheUserEntered = "the-new-room";
            string theRoomTheUserHasLeft = "forgotten-room";
            Client storedClient          = new Client
            {
                Room = theRoomTheUserHasLeft
            };

            NoticeCommand leftNotice = null;

            DomainEvents.OnCommand += (destination, command) =>
            {
                leftNotice = command as NoticeCommand;
                return(Task.CompletedTask);
            };

            ClientRepositoryMock.Setup(mock => mock.GetAllClientInTheRoomAsync(theRoomTheUserHasLeft)).Returns(Task.FromResult(new List <Client> {
                storedClient
            }.AsEnumerable()));
            ClientRepositoryMock.Setup(mock => mock.GetByUidAsync(connectionUid)).Returns(Task.FromResult(storedClient));

            // act
            await ChatFacade.UpdateRoomAsync(connectionUid, theRoomTheUserEntered);

            // assert
            Assert.IsNotNull(leftNotice);
        }
예제 #2
0
        public async Task Should_Notice_Everyone_About_The_Entrant_User_When_Updating_The_Current_User_Room()
        {
            // arrage
            Guid   connectionUid = Guid.NewGuid();
            string room          = "OtherRoom";
            Client storedClient  = new Client
            {
                Room = ""
            };

            NoticeCommand joinNotice = null;

            DomainEvents.OnCommand += (destination, command) =>
            {
                joinNotice = command as NoticeCommand;
                return(Task.CompletedTask);
            };

            ClientRepositoryMock.Setup(mock => mock.GetAllClientInTheRoomAsync(room)).Returns(Task.FromResult(new List <Client> {
                storedClient
            }.AsEnumerable()));
            ClientRepositoryMock.Setup(mock => mock.GetByUidAsync(connectionUid)).Returns(Task.FromResult(storedClient));

            // act
            await ChatFacade.UpdateRoomAsync(connectionUid, room);

            // assert
            Assert.IsNotNull(joinNotice);
        }
 public UnitOfWorkEntityFramework(FrapperDbContext context)
 {
     _context             = context;
     AssignedRolesCommand = new AssignedRolesCommand(_context);
     RoleCommand          = new RoleCommand(_context);
     UserMasterCommand    = new UserMasterCommand(_context);
     UserTokensCommand    = new UserTokensCommand(_context);
     MenuCategoryCommand  = new MenuCategoryCommand(_context);
     MenuMasterCommand    = new MenuMasterCommand(_context);
     SubMenuMasterCommand = new SubMenuMasterCommand(_context);
     VerificationCommand  = new VerificationCommand(_context);
     ProfileImageCommand  = new ProfileImageCommand(_context);
     NoticeCommand        = new NoticeCommand(_context);
     NoticeDetailsCommand = new NoticeDetailsCommand(_context);
     DocumentCommand      = new DocumentCommand(_context);
 }