Exemplo n.º 1
0
        public void TestRegisterWithWattTime()
        {
            // Arrange
            EmissionsApiInteraction emissionsApiInteraction = new EmissionsApiInteraction(selfThrottlingMethod, maxNumberOfCallsPerMinute);

            // Act
            var tokenReturned = emissionsApiInteraction.RegisterWithWattTime(this.wattTimeApiV2Url, WattTimeUsername, WattTimePassword, WattTimeEmail, WattTimeOrganization);

            // Assert
            Assert.IsNotNull(tokenReturned);
        }
Exemplo n.º 2
0
        public void TestGetGenerationMixAndSystemWideEmissionsResults()
        {
            // Arrange
            var regionAbbreviation = "PJM";
            EmissionsApiInteraction emissionsApiInteraction = new EmissionsApiInteraction(selfThrottlingMethod, maxNumberOfCallsPerMinute);

            emissionsApiInteraction.RegisterWithWattTime(this.wattTimeApiV2Url, WattTimeUsername, WattTimePassword, WattTimeEmail, WattTimeOrganization);

            // Act
            var pointsReturned = emissionsApiInteraction.GetGenerationMixAndSystemWideEmissionsResults(this.wattTimeApiUrl, regionAbbreviation, DateTime.Now.AddDays(-15), DateTime.Now.AddDays(2), null, wattTimeApiKey);

            // Assert
            Assert.IsTrue(pointsReturned.Count > 0);
        }
Exemplo n.º 3
0
        public void TestGetMostRecentMarginalCarbonEmissionsResult()
        {
            // Arrange
            var regionAbbreviation = "PJM";
            EmissionsApiInteraction emissionsApiInteraction = new EmissionsApiInteraction(selfThrottlingMethod, maxNumberOfCallsPerMinute);

            emissionsApiInteraction.RegisterWithWattTime(this.wattTimeApiV2Url, WattTimeUsername, WattTimePassword, WattTimeEmail, WattTimeOrganization);

            // Act
            var pointsReturned = emissionsApiInteraction.GetMostRecentMarginalCarbonEmissionsResult(this.wattTimeApiV2Url, regionAbbreviation, WattTimeUsername, WattTimePassword);

            // Assert
            Assert.IsTrue(pointsReturned.value > -1);
        }
Exemplo n.º 4
0
        public void TestCarbonEmissionsRelativeMeritResults()
        {
            // Arrange
            var regionAbbreviation = "PJM";
            EmissionsApiInteraction emissionsApiInteraction = new EmissionsApiInteraction(selfThrottlingMethod, maxNumberOfCallsPerMinute);

            emissionsApiInteraction.RegisterWithWattTime(this.wattTimeApiV2Url, WattTimeUsername, WattTimePassword, WattTimeEmail, WattTimeOrganization);

            // Act
            var indexReturned = emissionsApiInteraction.GetCarbonEmissionsRelativeMeritResults(this.wattTimeApiV2Url, regionAbbreviation, WattTimeUsername, WattTimePassword);

            // Assert
            Assert.IsTrue(-1 < indexReturned.rating);
            Assert.IsTrue(indexReturned.rating < 6);
        }