public void GetUpsertWithIdAndGeoNetWorkIdShouldReturnView() { ////Arrange var testUser = DataHelper.GetTestUser(); testUser.GeoNetworkId = 5; var testRoles = DataHelper.GetTestRoles(); var testUserDTO = DataHelper.GetTestUserDTO(); userService.Arrange(s => s.Get(Arg.IsAny <Guid>())).Returns(testUser); roleService.Arrange(s => s.Get(Arg.IsAny <Guid>())).Returns(testRoles); restApiService.Arrange(s => s.GetClient(Arg.IsAny <UserPrincipal>())).Returns(new HttpClient()); restApiService.Arrange(s => s.GetRequest <UserDTO>(Arg.IsAny <HttpClient>(), Arg.IsAny <string>())) .Returns(testUserDTO); restApiService.Arrange(s => s.GetRequest <List <UserGroup> >(Arg.IsAny <HttpClient>(), Arg.IsAny <string>())) .Returns(testUserDTO); ////Act var result = userController.Upsert(Guid.NewGuid()); ////Assert result.Should().BeOfType(typeof(ViewResult)); var mappedResult = result as ViewResult; mappedResult.Model.Should().Be(typeof(UserUpsertViewModel)); var mappedModel = mappedResult.Model as UserUpsertViewModel; mappedModel.UserName.Should().NotBeNullOrWhiteSpace(); mappedModel.UserName.Should().Be(testUser.UserName); mappedModel.Roles.Should().NotBeNullOrEmpty(); mappedModel.Roles.Count.Should().Be(testRoles.Count); }