internal void TestGetPerson(string input, WebexTeamsPerson apiResponse, GlobalXPerson output) { this.Given(x => GivenAPersonId(input)) .When(x => WhenGettingAPerson(apiResponse)) .Then(x => ThenItShouldReturnPersonDetails(output)) .BDDfy(); }
private static void ComparePeople(GlobalXPerson expected, GlobalXPerson actual) { actual.ShouldNotBeNull(); actual.ShouldSatisfyAllConditions( () => actual.Created.ShouldBe(expected.Created), () => actual.Username.ShouldBe(expected.Username), () => actual.UserId.ShouldBe(expected.UserId), () => { if (expected.Emails != null) { actual.Emails.ShouldNotBeNull(); actual.Emails.OrderBy(x => x).SequenceEqual(expected.Emails.OrderBy(x => x)).ShouldBe(true); } else { actual.Emails.ShouldBeNull(); } }, () => actual.Type.ShouldBe(expected.Type) ); }
private void ThenItShouldReturnPersonDetails(GlobalXPerson output) { _output.ShouldNotBeNull(); _output.ShouldSatisfyAllConditions( () => _output.Created.ShouldBe(output.Created), () => _output.Username.ShouldBe(output.Username), () => _output.UserId.ShouldBe(output.UserId), () => { if (output.Emails != null) { _output.Emails.ShouldNotBeNull(); _output.Emails.OrderBy(x => x).SequenceEqual(output.Emails.OrderBy(x => x)).ShouldBe(true); } else { _output.Emails.ShouldBeNull(); } }, () => _output.Type.ShouldBe(output.Type) ); }
private async void WhenGettingAPerson(WebexTeamsPerson apiResponse) { _apiService.GetPersonAsync(_input).Returns(Task.FromResult(apiResponse)); _output = await _subject.GetPersonAsync(_input); }