Exemplo n.º 1
0
 public Chapter(IHttpGetStringCommand httpGetStringCommand, string meetupGroupUrl, string name, string twitterName)
 {
     _httpGetStringCommand = httpGetStringCommand;
     Name           = name;
     MeetupGroupUrl = meetupGroupUrl;
     TwitterName    = twitterName;
 }
Exemplo n.º 2
0
 public async Task Meetup_group_information_can_not_be_retrieved_when_communication_with_meetup_dot_com_fails()
 {
     _httpGetStringCommand = Substitute.For<IHttpGetStringCommand>();
     _httpGetStringCommand.InvokeAsync(Arg.Any<Uri>()).Returns(u => { throw new HttpRequestException("Dummy"); });
     _organization = await Organization.Create(_meetupSettings, _httpGetStringCommand);
     Assert.That(_organization.Chapters.First().MeetupGroup, Is.Null);
 }
Exemplo n.º 3
0
 public Chapter(IMeetupSettings meetupSettings, IHttpGetStringCommand httpGetStringCommand, string meetupGroupUrl, string name, string twitterName)
 {
     _meetupSettings = meetupSettings;
     _httpGetStringCommand = httpGetStringCommand;
     Name = name;
     MeetupGroupUrl = meetupGroupUrl;
     TwitterName = twitterName;
 }
Exemplo n.º 4
0
        public async Task Meetup_group_information_can_not_be_retrieved_when_communication_with_meetup_dot_com_fails()
        {
            _httpGetStringCommand = Substitute.For <IHttpGetStringCommand>();
            _httpGetStringCommand.InvokeAsync(Arg.Any <Uri>()).Returns <string>(c => throw new HttpRequestException("Dummy"));
            _organization = await Organization.Create(_httpGetStringCommand);

            Assert.That(_organization.Chapters.First().MeetupGroup, Is.Null);
        }
Exemplo n.º 5
0
 public void SetUp()
 {
     _meetupSettings = Substitute.For<IMeetupSettings>();
     _meetupSettings.GetSignedGroupUri(Arg.Any<string>()).Returns(new Uri("http://api.meetup.com/2/groups?meetupgroupname1"));
     _meetupSettings.GetSignedEventUri(Arg.Any<string>()).Returns(new Uri("http://api.meetup.com/2/events?meetupgroupname1"));
     _httpGetStringCommand = Substitute.For<IHttpGetStringCommand>();
     _httpGetStringCommand.InvokeAsync(Arg.Is<Uri>(u => u.Segments.Last() == "groups")).Returns(Task.FromResult(TestData.MeetupApiResponse.GroupNnugTrondheim));
     _httpGetStringCommand.InvokeAsync(Arg.Is<Uri>(u => u.Segments.Last() == "events")).Returns(Task.FromResult(TestData.MeetupApiResponse.EventsNnugTrondheim));
 }
Exemplo n.º 6
0
        public static async Task <Organization> Create(IHttpGetStringCommand httpGetStringCommand)
        {
            var organization = new Organization();
            var chapters     = new List <Chapter>
            {
                //new Chapter(meetupSettings, httpGetStringCommand, "nnug-online", "NNUG Online", "NNUGOnline"),
                new Chapter(httpGetStringCommand, "nnugoslo", "NNUG Oslo", "NNUGOslo"),
                new Chapter(httpGetStringCommand, "bitshift", "BitShift", "BitShiftBergen"),
                new Chapter(httpGetStringCommand, "nnug-trondheim", "NNUG Trondheim", "NNUGTrondheim"),
                new Chapter(httpGetStringCommand, "nnug-stavanger", "NNUG Stavanger", "NNUGStavanger"),
                new Chapter(httpGetStringCommand, "nnug-kristiansand", "NNUG Kristiansand", ""),
                new Chapter(httpGetStringCommand, "nnug-haugesund", "NNUG Haugesund", "NNUGHaugesund"),
                new Chapter(httpGetStringCommand, "nnug-vestfold", "NNUG Vestfold", "NNUGVestfold"),
            };

            foreach (var chapter in chapters)
            {
                await chapter.LoadFromMeetupAsync();
            }

            organization.Chapters = chapters.OrderByDescending(c => c.NumberOfMembers).ToList();

            return(organization);
        }
Exemplo n.º 7
0
        public static async Task<Organization> Create(IMeetupSettings meetupSettings, IHttpGetStringCommand httpGetStringCommand)
        {
            var organization = new Organization();
            var chapters = new List<Chapter>
                           {
                               //new Chapter(meetupSettings, httpGetStringCommand, "nnug-online", "NNUG Online", "NNUGOnline"),
                               new Chapter(meetupSettings, httpGetStringCommand, "nnugoslo", "NNUG Oslo", "NNUGOslo"),
                               new Chapter(meetupSettings, httpGetStringCommand, "nnug-bergen", "NNUG Bergen", "NNUGBergen"),
                               new Chapter(meetupSettings, httpGetStringCommand, "nnug-trondheim", "NNUG Trondheim", "NNUGTrondheim"),
                               new Chapter(meetupSettings, httpGetStringCommand, "nnug-stavanger", "NNUG Stavanger", "NNUGStavanger"),
                               new Chapter(meetupSettings, httpGetStringCommand, "nnug-kristiansand", "NNUG Kristiansand", ""),
                               new Chapter(meetupSettings, httpGetStringCommand, "nnug-haugesund", "NNUG Haugesund", "NNUGHaugesund"),
                               new Chapter(meetupSettings, httpGetStringCommand, "nnug-vestfold", "NNUG Vestfold", "NNUGVestfold"),
                           };

            foreach (var chapter in chapters)
            {
                await chapter.LoadFromMeetupAsync();
            }

            organization.Chapters = chapters.OrderByDescending(c => c.NumberOfMembers).ToList();

            return organization;
        }
Exemplo n.º 8
0
 public MeetupGroup(IMeetupSettings meetupSettings, IHttpGetStringCommand httpGetStringCommand, string meetupGroupUrl)
 {
     _meetupSettings = meetupSettings;
     _httpGetStringCommand = httpGetStringCommand;
     _meetupGroupUrl = meetupGroupUrl;
 }
Exemplo n.º 9
0
 public MeetupGroup(IHttpGetStringCommand httpGetStringCommand, string meetupGroupUrl)
 {
     _httpGetStringCommand = httpGetStringCommand;
     _meetupGroupUrl       = meetupGroupUrl;
 }
Exemplo n.º 10
0
 public MeetupApiClient(IHttpGetStringCommand httpGetStringCommand)
 {
     _httpGetStringCommand = httpGetStringCommand;
 }
Exemplo n.º 11
0
 public void SetUp()
 {
     _httpGetStringCommand = Substitute.For <IHttpGetStringCommand>();
     _httpGetStringCommand.InvokeAsync(Arg.Is <Uri>(u => u.Segments.Last() == "nnug-trondheim")).Returns(Task.FromResult(TestData.MeetupApiResponse.GroupNnugTrondheim));
     _httpGetStringCommand.InvokeAsync(Arg.Is <Uri>(u => u.Segments.Last() == "events")).Returns(Task.FromResult(TestData.MeetupApiResponse.EventsNnugTrondheim));
 }