public void ModelIsNull() { // Arrange var validator = new LanguageListValidator(null, codeService); // Act validator.Validate(controller.ModelState); // Assert controller.ModelState.IsValid.Should().BeTrue(); }
public void ModelListIncludesNull() { // Arrange codeServiceMockSetup.Setup(c => c.GetLanguageByCode(It.IsAny <string>())).Returns(new VmListItem() { Id = Guid.NewGuid() }); var list = new List <string>() { null, "language" }; var validator = new LanguageListValidator(list, codeService); // Act validator.Validate(controller.ModelState); // Assert controller.ModelState.IsValid.Should().BeTrue(); }
public void ModelListIncludesInvalidLanguage() { // Arrange codeServiceMockSetup.Setup(c => c.GetLanguageByCode("language")).Returns(new VmListItem() { Code = "code" }); codeServiceMockSetup.Setup(c => c.GetLanguageByCode("invalidLanguage")).Returns((VmListItem)null); var list = new List <string>() { null, "language", "invalidLanguage" }; var validator = new LanguageListValidator(list, codeService); // Act validator.Validate(controller.ModelState); // Assert controller.ModelState.IsValid.Should().BeFalse(); }