Exemple #1
0
        public async Task Sut_WhenSettingProperty_ShouldRaiseBeginValidation(
            [Frozen] Mock <IValidator> validator,
            SampleValidable sut,
            string value,
            CancellationTokenSource cancellationTokenSource)
        {
            //arrange
            sut.MonitorEvents();

            //act
            await sut.SetValueAsyncPublic(value, "Property", cancellationTokenSource);

            //assert
            sut.ShouldRaise("BeginValidation");
        }
Exemple #2
0
        public async Task Sut_WhenSettingProperty_ShouldRaiseErrorChanged(
            [Frozen] TestSchedulers schedulers,
            [Frozen] Mock <IValidator> validator,
            SampleValidable sut,
            string value)
        {
            //arrange
            validator.Setup(v => v.Validate(value, "Property", It.IsAny <CancellationToken>()))
            .ReturnsTask(new ValidationError("message", null));
            sut.MonitorEvents();

            //act
            await sut.SetValueAsyncPublic(value, "Property", new CancellationTokenSource());

            //assert
            sut.ShouldRaise("ErrorsChanged");
        }