public void Response_should_contain_response_from_children_usecase(string propertyReference) { //arrange var expectedResponse = new GetPropertyChildrenResponse { Children = new List <Property> { new Property { MajorRef = propertyReference } } }; _mockUseCase.Setup(s => s.Execute(It.Is <GetPropertyChildrenRequest>(i => i.PropertyReference == propertyReference))) .Returns(expectedResponse); //act var response = _classUnderTest.GetChildenProperties(propertyReference); var okResult = (OkObjectResult)response; var resultContent = (GetPropertyChildrenResponse)okResult.Value; //assert okResult.Should().NotBeNull(); okResult.Value.Should().NotBeNull(); resultContent.Should().NotBeNull(); JsonConvert.SerializeObject(expectedResponse).Should().BeEquivalentTo(JsonConvert.SerializeObject(resultContent)); }
public void PropertyReference_should_be_the_same_as_the_majorReference_on_response_property(string propertyReference) { //arrange var expectedProperty = _uhPropertyHelper.GenerateUhProperty(); expectedProperty.MajorRef = propertyReference; _uhContext.UhPropertys.Add(expectedProperty); _uhContext.SaveChanges(); //act var response = _classUnderTest.GetChildenProperties(propertyReference); var okResult = (OkObjectResult)response; //assert var getPropertyChildrenResponse = okResult.Value as GetPropertyChildrenResponse; getPropertyChildrenResponse.Children[0].MajorRef.Should().Be(propertyReference); }