Exemplo n.º 1
0
        public void RequestToLiveDataControllerReturnsTwitterStatsDetails()
        {
            TwitterStatsDetails expectedTwitterStatsDetails = new TwitterStatsDetails();

            Mock <ITwitterEstimatedLiveDataRetriever> mockTwitterEstimatedLiveDataRetriever = new Mock <ITwitterEstimatedLiveDataRetriever>();

            mockTwitterEstimatedLiveDataRetriever.Setup(mteldr => mteldr.GetStats()).Returns(expectedTwitterStatsDetails);

            LiveDataController  liveDataController          = new LiveDataController(mockTwitterEstimatedLiveDataRetriever.Object);
            TwitterStatsDetails returnedTwitterStatsDetails = liveDataController.Get();

            Assert.Equal(expectedTwitterStatsDetails, returnedTwitterStatsDetails);
        }
Exemplo n.º 2
0
        public void EnsureDependenciesAreSetup()
        {
            IConfiguration configuration = new ConfigurationBuilder()
                                           .AddJsonFile("appsettings.Development.json")
                                           .Build();

            ServiceCollection services = new ServiceCollection();

            services.AddTransient <LiveDataController>();

            Startup startup = new Startup(configuration);

            startup.ConfigureServices(services);

            LiveDataController liveDataController = services.BuildServiceProvider().GetService <LiveDataController>();

            Assert.NotNull(liveDataController);
        }