public void Should_not_create_or_update_provider_on_post_put_when_provided_null_post_provider() { //Arrange var _providerRepo = new Mock <IRepository <ServiceProviderModel> >(); var _providerValidation = new Mock <IServicesValidation>(); _controller = new ServiceProvidersController(_providerRepo.Object, _serviceRepo.Object); //Act var result = JsonConvert.DeserializeObject <ResultModel>(_controller.Post(null)); var result1 = JsonConvert.DeserializeObject <ResultModel>(_controller.Put(null)); //Assert Assert.True(result.IsError); Assert.True(result1.IsError); }
public void Should_not_create_or_update_provider_on_post_put_when_provided_invalid_phone() { //Arrange var _providerRepo = new Mock <IRepository <ServiceProviderModel> >(); var id = Guid.NewGuid(); var post = new PostServiceProviderModel() { Address = "asd", Phone = "", ShopName = "name" }; _controller = new ServiceProvidersController(_providerRepo.Object, _serviceRepo.Object); //Act var result = JsonConvert.DeserializeObject <ResultModel>(_controller.Post(post)); var result1 = JsonConvert.DeserializeObject <ResultModel>(_controller.Put(post.ToServiceProviderModel())); //Assert Assert.True(result.IsError); Assert.True(result1.IsError); }