public CreateSessionTests()
        {
            _connectionSettings = new Mock <PokerConnectionSettings>();
            _options            = new Mock <IOptions <PokerConnectionSettings> >();
            _options.Setup(x => x.Value).Returns(_connectionSettings.Object);
            _responseMessageParser = new Mock <IResponseMessageParser>();
            _pokerConnection       = new Mock <IPokerConnection>();
            _userCacheProvider     = new Mock <UserCacheProvider>();
            _planningPokerService  = new Mock <IPlanningPokerService>();

            _planningPokerConnection = new PlanningPokerConnection(_options.Object, _responseMessageParser.Object,
                                                                   _pokerConnection.Object, _userCacheProvider.Object, _planningPokerService.Object);
        }
Example #2
0
        public OnSessionInformationUpdatedTests()
        {
            _connectionSettings = new Mock <PokerConnectionSettings>();
            _options            = new Mock <IOptions <PokerConnectionSettings> >();
            _options.Setup(x => x.Value).Returns(_connectionSettings.Object);
            _responseMessageParser = new Mock <IResponseMessageParser>();
            _pokerConnection       = new Mock <IPokerConnection>();
            _userCacheProvider     = new Mock <UserCacheProvider>();
            _planningPokerService  = new Mock <IPlanningPokerService>();

            _planningPokerConnection = new PlanningPokerConnection(_options.Object, _responseMessageParser.Object,
                                                                   _pokerConnection.Object, _userCacheProvider.Object, _planningPokerService.Object);

            _responseMessageParser.Setup(x => x.Get(It.IsAny <string>())).Returns(new RefreshSessionResponse(_expectedSessionId));

            _pokerConnection.Setup(x => x.Initialize(It.IsAny <Action <string> >(), It.IsAny <Action>(), It.IsAny <CancellationToken>()))
            .Callback <Action <string>, Action, CancellationToken>((success, error, cancel) => { _callbackMethod = success; })
            .Returns(Task.CompletedTask);
        }
Example #3
0
        //[Fact]
        public async void Test1()
        {
            // var connectionSettings = new PokerConnectionSettings
            // {
            //     PlanningSocketUri = new Uri("wss://planningpokercore.azurewebsites.net/ws"),
            //     PlanningApiUri = new Uri("https://sicarringtonplanningpokerapinew.azurewebsites.net/api")
            // };
            // var optionsMock = new Mock<IOptions<PokerConnectionSettings>>();
            // optionsMock.Setup(x => x.Value).Returns(connectionSettings);


            var builder = new ConfigurationBuilder()
                          //.SetBasePath(env.ContentRootPath)
                          .AddJsonFile("appsettings.json", optional: false, reloadOnChange: true);
            //.AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true)
            // .AddEnvironmentVariables();
            var Configuration = builder.Build();


            var serviceCollection = new ServiceCollection();

            serviceCollection.AddOptions();

            serviceCollection.AddPlanningPokerClient(Configuration);
            var serviceProvider       = serviceCollection.BuildServiceProvider();
            var connectionSettings    = serviceProvider.GetService <IOptions <PokerConnectionSettings> >();
            var responseMessageParser = serviceProvider.GetService <IResponseMessageParser>();
            var pokerConnection       = serviceProvider.GetService <IPokerConnection>();
            var userCacheProvider     = serviceProvider.GetService <UserCacheProvider>();
            var planningPokerService  = serviceProvider.GetService <IPlanningPokerService>();

            var planningConnection = new PlanningPokerConnection(connectionSettings, responseMessageParser, pokerConnection, userCacheProvider, planningPokerService);
            await planningConnection.Start(CancellationToken.None);

            await planningConnection.CreateSession("Simon");

            while (true)
            {
                System.Threading.Thread.Sleep(2000);
            }
        }