Example #1
0
 public void If_the_requested_topic_has_configured_a_quota_with_TimeRange_creates_an_TimeRangeQuota()
 {
     var hostConfiguration = new HostConfiguration();
     hostConfiguration.Topics.Add(new TopicConfiguration
     {
         TopicName = "testTopic",
         Quota = new QuotaConfiguration
         {
             TimeRange = new TimeRange
              {
                 From = new Time()
                 {
                     Hour = new Hour(10),
                     Minute = new Minute(3)
                 },
                 To = new Time()
                 {
                     Hour = new Hour(10),
                     Minute = new Minute(4)
                 }
             }
         }
     });
     var sut = new QuotaFactory(hostConfiguration);
     Assert.IsType<TimeRangeQuota>(sut.CreateQuota("testTopic").Value);
 }
Example #2
0
 public void If_configuration_for_topic_exists_but_has_not_configured_any_quota_creates_a_transparentQuota()
 {
     var hostConfiguration = new HostConfiguration();
     hostConfiguration.Topics.Add(new TopicConfiguration
     {
         TopicName = "testTopic"
     });
     var sut = new QuotaFactory(hostConfiguration);
     Assert.IsType<TransparentQuota>(sut.CreateQuota("testTopic").Value);
 }
Example #3
0
 public void If_the_requested_topic_has_configured_a_quota_with_ElapsedMinutes_creates_an_ElapsedTimeQuota()
 {
     var hostConfiguration = new HostConfiguration();
     hostConfiguration.Topics.Add(new TopicConfiguration
     {
         TopicName = "testTopic",
         Quota = new QuotaConfiguration
         {
             ElapsedMinutes = 2
         }
     });
     var sut = new QuotaFactory(hostConfiguration);
     Assert.IsType<ElapsedTimeQuota>(sut.CreateQuota("testTopic").Value);
 }
Example #4
0
 public void If_the_requested_topic_has_configured_a_quota_with_numberOfElements_creates_a_NumberOfElementsQuota()
 {
     var hostConfiguration = new HostConfiguration();
     hostConfiguration.Topics.Add(new TopicConfiguration
         {
             TopicName = "testTopic",
             Quota = new QuotaConfiguration
             {
                 NumberOfELements = 2
             }
         });
     var sut = new QuotaFactory(hostConfiguration);
     Assert.IsType<NumberOfElementsQuota>(sut.CreateQuota("testTopic").Value);
 }
Example #5
0
 public void If_configuration_is_null_creates_a_transparentQuota()
 {
     var hostConfiguration = new HostConfiguration();
     var sut = new QuotaFactory(hostConfiguration);
     Assert.IsType<TransparentQuota>(sut.CreateQuota("testTopic").Value);
 }