public void GetTeammate() { var subject = new GetTeammateResponse { FirstName = Faker.Name.First(), LastName = Faker.Name.Last(), ID = 5000, PrimaryPosition = "SF", IsStarter = false }; facade.Setup(x => x.GetTeammate(It.IsAny <long>())) .Returns(subject) .Verifiable(); // Arrange TeamController controller = new TeamController(facade.Object); // Act var result = controller.GetTeammate(5000); // Assert Assert.IsNotNull(result); Assert.IsInstanceOfType(result, typeof(OkNegotiatedContentResult <GetTeammateResponse>)); var response = result as OkNegotiatedContentResult <GetTeammateResponse>; Assert.AreEqual(subject, response.Content); facade.Verify(x => x.GetTeammate(It.IsAny <long>()), Times.Once); facade.VerifyNoOtherCalls(); }
public bool Equals(Teammate x, GetTeammateResponse y) { if (x == null || y == null) { return(false); } string position = x.PrimaryPosition.HasValue ? Enum.GetName(x.PrimaryPosition.Value.GetType(), x.PrimaryPosition.Value) : null; return(y != null && x.ID == y.ID && x.FirstName == y.FirstName && x.LastName == y.LastName && x.BirthDate == y.BirthDate && x.Height == y.Height && position == y.PrimaryPosition && x.IsStarter == y.IsStarter && x.Interests == y.Interests && x.Address == y.Address && x.City == y.City && x.State == y.State && x.Zipcode == y.Zipcode); }