public void AddressTypeIsLocation_2SIngleSubTypesIncluded_Valid() { // Arrange & act var vm = new VmOpenApiServiceLocationChannelInVersionBase() { Addresses = new List <V7VmOpenApiAddressWithMovingIn> { new V7VmOpenApiAddressWithMovingIn { Type = AddressConsts.LOCATION, SubType = AddressConsts.SINGLE }, new V7VmOpenApiAddressWithMovingIn { Type = AddressConsts.LOCATION, SubType = AddressConsts.SINGLE }, } }; var validator = new ServiceLocationChannelValidator(vm, commonService, codeService, serviceService); // Act validator.Validate(controller.ModelState); // Assert controller.ModelState.IsValid.Should().BeTrue(); }
public void AddressTypeIsLocation_SeveralForeigAddressesIncluded_NotValid(string type) { // Arrange & act var vm = new VmOpenApiServiceLocationChannelInVersionBase() { Addresses = new List <V7VmOpenApiAddressWithMovingIn> { new V7VmOpenApiAddressWithMovingIn { Type = type, SubType = AddressConsts.ABROAD }, new V7VmOpenApiAddressWithMovingIn { Type = type, SubType = AddressConsts.ABROAD }, } }; var validator = new ServiceLocationChannelValidator(vm, commonService, codeService, serviceService); // Act validator.Validate(controller.ModelState); // Assert controller.ModelState.IsValid.Should().BeFalse(); }
[InlineData(AddressConsts.POSTOFFICEBOX)] // not allowed public void AddressTypeIsLocation_SubTypeNotValid(string subType) { // Arrange & act var vm = new VmOpenApiServiceLocationChannelInVersionBase() { Addresses = new List <V7VmOpenApiAddressWithMovingIn> { new V7VmOpenApiAddressWithMovingIn { Type = AddressConsts.LOCATION, SubType = subType } } }; var validator = new ServiceLocationChannelValidator(vm, commonService, codeService, serviceService); // Act validator.Validate(controller.ModelState); // Assert controller.ModelState.IsValid.Should().BeFalse(); }
[InlineData(AddressConsts.ABROAD)] // allowed public void AddressTypeIsPostal_SubTypeValid(string subType) { // Arrange & act var vm = new VmOpenApiServiceLocationChannelInVersionBase() { Addresses = new List <V7VmOpenApiAddressWithMovingIn> { new V7VmOpenApiAddressWithMovingIn { Type = AddressCharacterEnum.Postal.ToString(), SubType = subType } } }; var validator = new ServiceLocationChannelValidator(vm, commonService, codeService, serviceService); // Act validator.Validate(controller.ModelState); // Assert controller.ModelState.IsValid.Should().BeTrue(); }