public void CanGetAWorkshop() { var expectedResponse = new AirtableResponseBuilder() .AddRecord( "rec0d7vSGRLxzbUNz", new DateTime(2019, 8, 22, 8, 25, 28) ).WithName("Coding Black Females - Code Dojo") .WithHost("Made Tech") .WithCategories("Meetup") .WithTime(2019, 9, 18, 17, 0, 0) .WithDurationInSeconds(10800) .WithLocation("Made Tech O'Meara'") .WithSessionType("Code Dojo") .Build(); airtableSimulator.SetUpAll(TABLE_ID, AIRTABLE_API_KEY, expectedResponse); AirtableGateway airtableGateway = new AirtableGateway(AIRTABLE_URL, AIRTABLE_API_KEY, TABLE_ID); var workshops = airtableGateway.All(); DateTime time = new DateTime(2019, 09, 18, 17, 00, 0); Assert.True(workshops[0].name.Contains("Coding Black Females - Code Dojo")); Assert.True(workshops[0].host.Contains("Made Tech")); Assert.AreEqual(workshops[0].time, time); Assert.True(workshops[0].location.Contains("O'Meara")); Assert.AreEqual(workshops[0].duration, 180); Assert.True(workshops[0].type.Contains("Code Dojo")); }
public void CanGetAWorkshop() { var expectedResponse = new AirtableResponseBuilder() .AddRecord( "rec0d7vSGRLxzbUNz", new DateTime(2019, 8, 22, 8, 25, 28) ).WithName("Coding Black Females - Code Dojo") .WithHost("Made Tech") .WithCategories("Meetup") .WithTime(2019, 9, 18, 17, 0, 0) .WithDurationInSeconds(10800) .WithLocation("Made Tech O'Meara") .WithSessionType("Code Dojo") .Build(); airtableSimulator.SetUpAll(expectedResponse, TABLE_ID, AIRTABLE_API_KEY); AirtableGateway airtableGateway = new AirtableGateway(AIRTABLE_URL, AIRTABLE_API_KEY, TABLE_ID); var workshops = airtableGateway.All(); DateTime time = new DateTime(2019, 09, 18, 17, 00, 0); var firstWorkshop = workshops[0]; firstWorkshop.name.Should().Be("Coding Black Females - Code Dojo"); firstWorkshop.host.Should().Be("Made Tech"); firstWorkshop.time.Should().Be(time); firstWorkshop.location.Should().Be("Made Tech O'Meara"); firstWorkshop.duration.Should().Be(180); firstWorkshop.type.Should().Be("Code Dojo"); }
public void CanGetTwoAirtableWorkshops() { var getRecordsResponse = new AirtableResponseBuilder() .AddRecord( "rec4rdaOkafgV1Bqm", new DateTime(2019, 8, 22, 8, 25, 28) ).WithName("Team Performance: Team Agile-Lean maturity 'measures' in practice (at DfE and Hackney)") .WithHost("Barry") .WithCategories("Delivery") .WithTime(2019, 10, 18, 13, 0, 0) .WithDurationInSeconds(3600) .WithLocation("Everest, 2nd Foor") .WithSessionType("Seminar") .AddRecord( "reca7W6WxWubIR7CK", new DateTime(2019, 8, 27, 5, 24, 25) ) .WithName("Account Leadership - Roles & Responsibilities") .WithHost("Rory") .WithCategories("Sales", "Workshop", "Life Skills", "Business") .WithTime(2019, 10, 18, 14, 30, 0) .WithDurationInSeconds(3600) .WithLocation("Everest") .WithSessionType("Workshop") .Build(); airtable.SetUpAll(getRecordsResponse, TABLE_ID, AIRTABLE_API_KEY); var response = GetWorkshops(); DateTime sourceDate = new DateTime(2019, 10, 18, 14, 00, 0); DateTimeOffset time = new DateTimeOffset(sourceDate, TimeZoneInfo.FindSystemTimeZoneById("Europe/London").GetUtcOffset(sourceDate)); DateTime sourceDate2 = new DateTime(2019, 10, 18, 15, 30, 0); DateTimeOffset time2 = new DateTimeOffset(sourceDate2, TimeZoneInfo.FindSystemTimeZoneById("Europe/London").GetUtcOffset(sourceDate2)); PresentableWorkshop[] presentableWorkshops = response.PresentableWorkshops; var theFirstWorkshop = presentableWorkshops[0]; var theSecondWorkshop = presentableWorkshops[1]; theFirstWorkshop.Name.Should().Be("Team Performance: Team Agile-Lean maturity 'measures' in practice (at DfE and Hackney)"); theFirstWorkshop.Host.Should().Be("Barry"); theFirstWorkshop.Time.Should().Be(time); theFirstWorkshop.Location.Should().Be("Everest, 2nd Foor"); theFirstWorkshop.Duration.Should().Be(60); theFirstWorkshop.Type.Should().Be("Seminar"); theSecondWorkshop.Name.Should().Be("Account Leadership - Roles & Responsibilities"); theSecondWorkshop.Host.Should().Be("Rory"); theSecondWorkshop.Time.Should().Be(time2); theSecondWorkshop.Location.Should().Be("Everest"); theSecondWorkshop.Duration.Should().Be(60); theSecondWorkshop.Type.Should().Be("Workshop"); }
public void CanGetTwoAirtableWorkshops() { var expectedResponse = new AirtableResponseBuilder() .AddRecord( "rec4rdaOkafgV1Bqm", new DateTime(2019, 8, 22, 8, 25, 28) ).WithName("Team Performance: Team Agile-Lean maturity 'measures' in practice (at DfE and Hackney)") .WithHost("Barry") .WithCategories("Delivery") .WithTime(2019, 10, 18, 13, 0, 0) .WithDurationInSeconds(3600) .WithLocation("Everest, 2nd Foor") .WithSessionType("Seminar") .AddRecord( "reca7W6WxWubIR7CK", new DateTime(2019, 8, 27, 5, 24, 25) ) .WithName("Account Leadership - Roles & Responsibilities") .WithHost("Rory") .WithCategories("Sales", "Workshop", "Life Skills", "Business") .WithTime(2019, 10, 18, 14, 30, 0) .WithDurationInSeconds(3600) .WithLocation("Everest") .WithSessionType("Workshop") .Build(); airtableSimulator.SetUpAll( TABLE_ID, AIRTABLE_API_KEY, expectedResponse ); AirtableGateway airtableGateway = new AirtableGateway(AIRTABLE_URL, AIRTABLE_API_KEY, TABLE_ID); GetWorkshops getWorkshops = new GetWorkshops(airtableGateway); GetWorkshopsResponse response = getWorkshops.Execute(); DateTime sourceDate = new DateTime(2019, 10, 18, 14, 00, 0); DateTimeOffset time = new DateTimeOffset(sourceDate, TimeZoneInfo.FindSystemTimeZoneById("Europe/London").GetUtcOffset(sourceDate)); DateTime sourceDate2 = new DateTime(2019, 10, 18, 15, 30, 0); DateTimeOffset time2 = new DateTimeOffset(sourceDate2, TimeZoneInfo.FindSystemTimeZoneById("Europe/London").GetUtcOffset(sourceDate2)); PresentableWorkshop[] presentableWorkshops = response.PresentableWorkshops; Assert.AreEqual("Team Performance: Team Agile-Lean maturity 'measures' in practice (at DfE and Hackney)", presentableWorkshops[0].Name); Assert.AreEqual("Barry", presentableWorkshops[0].Host); Assert.AreEqual(time, presentableWorkshops[0].Time); Assert.AreEqual("Everest, 2nd Foor", presentableWorkshops[0].Location); Assert.AreEqual(60, presentableWorkshops[0].Duration); Assert.AreEqual("Seminar", presentableWorkshops[0].Type); Assert.AreEqual("Account Leadership - Roles & Responsibilities", response.PresentableWorkshops[1].Name); Assert.AreEqual("Rory", presentableWorkshops[1].Host); Assert.AreEqual(time2, presentableWorkshops[1].Time); Assert.AreEqual("Everest", presentableWorkshops[1].Location); Assert.AreEqual(60, presentableWorkshops[1].Duration); Assert.AreEqual("Workshop", presentableWorkshops[1].Type); }