Exemplo n.º 1
0
        public override void SetUp()
        {
            base.SetUp();

            schedule = new Dictionary <string, TimeSpan>
            {
                { "facebook", TimeSpan.FromMinutes(10) },
                { "twitter", TimeSpan.FromMinutes(5) },
            };

            topic = new Topic
            {
                Bus       = Bus,
                Timers    = Timers,
                Reminders = Reminders,
                Storage   = storage = new TopicStorageMock(),
                State     = state = new TopicState()
            };
        }
Exemplo n.º 2
0
        public async Task <TopicState> ReadStateAsync(string id)
        {
            var state = new TopicState();

            var blob = container.GetBlockBlobReference(GetBlobName(id));

            if (!(await blob.ExistsAsync()))
            {
                return(state);
            }

            var contents = await blob.DownloadTextAsync();

            if (string.IsNullOrWhiteSpace(contents))
            {
                return(state);
            }

            state.Total = int.Parse(contents);
            return(state);
        }
Exemplo n.º 3
0
 public Task WriteStateAsync(string id, TopicState state)
 {
     return(TaskDone.Done);
 }
Exemplo n.º 4
0
 public async Task Activate()
 {
     State = await Storage.ReadStateAsync(Id);
 }
Exemplo n.º 5
0
        public Task WriteStateAsync(string id, TopicState state)
        {
            var blob = container.GetBlockBlobReference(GetBlobName(id));

            return(blob.UploadTextAsync(state.Total.ToString(CultureInfo.InvariantCulture)));
        }