public void Validate_WhenCalled_AssertShouldBeFutureDateTimeWasCalledOnDateTimeValidatorForExpires() { DateTime expires = _fixture.Create <DateTime>(); IContactCommand sut = CreateSut(expires: expires); sut.Validate(_validatorMockContext.ValidatorMock.Object, _microsoftGraphRepositoryMock.Object, _contactRepositoryMock.Object, _accountingRepositoryMock.Object); _validatorMockContext.DateTimeValidatorMock.Verify(m => m.ShouldBeFutureDateTime( It.Is <DateTime>(value => value == expires), It.Is <Type>(value => value == sut.GetType()), It.Is <string>(value => string.CompareOrdinal(value, "Expires") == 0)), Times.Once); }
public void Validate_WhenCalled_AssertShouldNotBeNullOrWhiteSpaceWasCalledOnStringValidatorForAccessToken() { string accessToken = _fixture.Create <string>(); IContactCommand sut = CreateSut(accessToken: accessToken); sut.Validate(_validatorMockContext.ValidatorMock.Object, _microsoftGraphRepositoryMock.Object, _contactRepositoryMock.Object, _accountingRepositoryMock.Object); _validatorMockContext.StringValidatorMock.Verify(m => m.ShouldNotBeNullOrWhiteSpace( It.Is <string>(value => string.CompareOrdinal(value, accessToken) == 0), It.Is <Type>(value => value == sut.GetType()), It.Is <string>(value => string.CompareOrdinal(value, "AccessToken") == 0)), Times.Once); }
public void Validate_WhenCalled_AssertShouldHaveMaxLengthWasCalledOnStringValidatorForAcquaintance() { string acquaintance = _fixture.Create <string>(); IContactCommand sut = CreateSut(acquaintance: acquaintance); sut.Validate(_validatorMockContext.ValidatorMock.Object, _microsoftGraphRepositoryMock.Object, _contactRepositoryMock.Object, _accountingRepositoryMock.Object); _validatorMockContext.StringValidatorMock.Verify(m => m.ShouldHaveMaxLength( It.Is <string>(value => string.CompareOrdinal(value, acquaintance) == 0), It.Is <int>(value => value == 4096), It.Is <Type>(value => value == sut.GetType()), It.Is <string>(value => string.CompareOrdinal(value, "Acquaintance") == 0), It.Is <bool>(value => value)), Times.Once); }
public void Validate_WhenCalled_AssertShouldMatchPatternWasCalledOnStringValidatorForMailAddress() { string mailAddress = _fixture.Create <string>(); IContactCommand sut = CreateSut(mailAddress: mailAddress); sut.Validate(_validatorMockContext.ValidatorMock.Object, _microsoftGraphRepositoryMock.Object, _contactRepositoryMock.Object, _accountingRepositoryMock.Object); _validatorMockContext.StringValidatorMock.Verify(m => m.ShouldMatchPattern( It.Is <string>(value => string.CompareOrdinal(value, mailAddress) == 0), It.Is <Regex>(value => string.CompareOrdinal(value.ToString(), RegexTestHelper.MailAddressRegexPattern) == 0), It.Is <Type>(value => value == sut.GetType()), It.Is <string>(value => string.CompareOrdinal(value, "MailAddress") == 0), It.Is <bool>(value => value)), Times.Once); }
public void Validate_WhenCalled_AssertShouldNotBeNullWasCalledOnObjectValidatorForName() { INameCommand nameCommand = CreateNameCommandMock().Object; IContactCommand sut = CreateSut(nameCommand: nameCommand); sut.Validate(_validatorMockContext.ValidatorMock.Object, _microsoftGraphRepositoryMock.Object, _contactRepositoryMock.Object, _accountingRepositoryMock.Object); _validatorMockContext.ObjectValidatorMock.Verify(m => m.ShouldNotBeNull( It.Is <INameCommand>(value => value == nameCommand), It.Is <Type>(value => value == sut.GetType()), It.Is <string>(value => string.CompareOrdinal(value, "Name") == 0)), Times.Once); }
public void Validate_WhenCommandHasBirthday_AssertShouldBePastDateOrTodayWasCalledOnDateTimeValidatorBirthday() { DateTime birthday = _fixture.Create <DateTime>(); IContactCommand sut = CreateSut(birthday: birthday); sut.Validate(_validatorMockContext.ValidatorMock.Object, _microsoftGraphRepositoryMock.Object, _contactRepositoryMock.Object, _accountingRepositoryMock.Object); _validatorMockContext.DateTimeValidatorMock.Verify(m => m.ShouldBePastDateOrToday( It.Is <DateTime>(value => value == birthday), It.Is <Type>(value => value == sut.GetType()), It.Is <string>(value => string.CompareOrdinal(value, "Birthday") == 0)), Times.Once); }
public void Validate_WhenCommandDoesNotHaveBirthday_AssertShouldBePastDateOrTodayWasNotCalledOnDateTimeValidatorBirthday() { IContactCommand sut = CreateSut(hasBirthday: false); sut.Validate(_validatorMockContext.ValidatorMock.Object, _microsoftGraphRepositoryMock.Object, _contactRepositoryMock.Object, _accountingRepositoryMock.Object); _validatorMockContext.DateTimeValidatorMock.Verify(m => m.ShouldBePastDateOrToday( It.IsAny <DateTime>(), It.Is <Type>(value => value == sut.GetType()), It.Is <string>(value => string.CompareOrdinal(value, "Birthday") == 0)), Times.Never); }