Пример #1
0
        public async Task IF_not_Active_SHOULD_fail(EntityState invalidState)
        {
            //Arrange
            ExistingEntityBuilder.With(x => x.EntityState, invalidState);

            //Act
            var result = await Sut.HandleAsync(Command, AdminUser);

            //Assert
            result.VerifyResponseError(DomainErrors.InvalidEntityState(invalidState), MockAnalyticsService);
        }
        public async Task IF_not_Draft_or_Archived_SHOULD_fail(EntityState invalidState)
        {
            //Arrange
            ExistingEntityBuilder.With(x => x.EntityState, invalidState);

            //Act
            var result = await Sut.HandleAsync(Command, AdminUser);

            //Assert
            result.VerifyResponseError(DomainErrors.InvalidEntityState(invalidState), MockAnalyticsService);
            Assert.That(DbContextAfter.Set <TEntity>().First(x => x.Id == GrainId).EntityState, Is.Not.EqualTo(EntityState.Draft));
        }
Пример #3
0
        public async Task IF_Active_SHOULD_Activate(EntityState validState)
        {
            //Arrange
            ExistingEntityBuilder.With(x => x.EntityState, validState);

            //Act
            var result = await Sut.HandleAsync(Command, AdminUser);

            //Assert
            Assert.That(result.IsSuccess);
            var modifiedEntity = DbContextAfter.Set <TEntity>().First(x => x.Id == GrainId);

            Assert.That(modifiedEntity.ModifiedAt, Is.EqualTo(RunTime));
            Assert.That(modifiedEntity.EntityState, Is.EqualTo(EntityState.Archived));
        }