public async Task UpdatePermissions_returns_error_string_when_operations_is_null() { //Arrange var controller = new PermissionsController(_configuration, _contextAccessor); dynamic permissionObj = new ExpandoObject(); permissionObj.Modules = new List <PermissionsSet>(); permissionObj.Operations = null; JObject data = JObject.FromObject(permissionObj); //Act var result = await controller.UpdatePermissions(data); //Assert var messageResult = Assert.IsType <string>(result); //Asserting that the return is a String Assert.Contains("Value cannot be null", messageResult); //Asserting that message is equal as mentioned }
public async Task UpdatePermissions_returns_error_string_when_ownerId_does_not_exist() { //Arrange var controller = new PermissionsController(_configuration, _contextAccessor); dynamic permissionObj = new ExpandoObject(); permissionObj.Modules = new List <PermissionsSet>(); permissionObj.Operations = new List <PermissionsOperation>(); JObject data = JObject.FromObject(permissionObj); //Act var result = await controller.UpdatePermissions(data); //Assert var messageResult = Assert.IsType <string>(result); //Asserting that the return is a String Assert.Contains("Object reference not set to an instance of an object", messageResult); //Asserting that message is equal as mentioned }
public async Task UpdatePermissions_returns_error_string_when_data_passed_is_incorrect() { //Arrange var controller = new PermissionsController(_bosIAClient); dynamic permissionObj = new ExpandoObject(); permissionObj.Modules = new List <PermissionsSet>(); permissionObj.Operations = new List <PermissionsOperation>(); permissionObj.OwnerId = Guid.NewGuid(); JObject data = JObject.FromObject(permissionObj); //Act var result = await controller.UpdatePermissions(data); //Assert var messageResult = Assert.IsType <string>(result); //Asserting that the return is a String //Assert.Contains("Unrecognized Guid format", messageResult); //Asserting that message is equal as mentioned }