public void TestGetMemberList() { ActionResult <List <DisplayMemberDTO> > response = _flatController.GetMembers(); Assert.IsNotNull(response.Value); Assert.That(response.Value.Count, Is.EqualTo(4)); Assert.That(response.Value.Select(m => m.UserName).ToList(), Is.EquivalentTo(new[] { "BeboBryan", "TreesAreGreen", "YinWang", "TonOfClay" })); Assert.That(response.Value.Select(m => m.FirstName).ToList(), Is.EquivalentTo(new[] { "Bryan", "Teresa", "Yin", "Clay" })); Assert.That(response.Value.Select(m => m.LastName).ToList(), Is.EquivalentTo(new[] { "Ang", "Green", "Wang", "Ton" })); Assert.That(response.Value.Select(m => m.Email).ToList(), Is.EquivalentTo(new[] { "*****@*****.**", "*****@*****.**", "*****@*****.**", "*****@*****.**" })); }
public void TestGetMemberList() { // Arrange var usernames = new[] { "BeboBryan", "TreesAreGreen", "YinWang", "TonOfClay" }; var firstNames = new[] { "Bryan", "Teresa", "Yin", "Clay" }; var lastNames = new[] { "Ang", "Green", "Wang", "Ton" }; var emails = new[] { "*****@*****.**", "*****@*****.**", "*****@*****.**", "*****@*****.**" }; // Act var response = _flatController.GetMembers(); // Assert Assert.IsNotNull(response.Value); Assert.That(response.Value.Count, Is.EqualTo(4)); Assert.That(response.Value.Select(m => m.UserName).ToList(), Is.EquivalentTo(usernames)); Assert.That(response.Value.Select(m => m.FirstName).ToList(), Is.EquivalentTo(firstNames)); Assert.That(response.Value.Select(m => m.LastName).ToList(), Is.EquivalentTo(lastNames)); Assert.That(response.Value.Select(m => m.Email).ToList(), Is.EquivalentTo(emails)); }