Esempio n. 1
0
        public void RemoveObject()
        {
            // Arrange
            this._dbFixture.TestInitialize();

            int initialCount = 0;
            var cmd = new RemoveUserCommand(this._sampleData.Id);

            // Act
            initialCount = this._unitOfWorkFactory
                .ExecuteSingleQuery<IGetCountQuery, int>(q => q.Execute<UserDto>());

            this._unitOfWorkFactory.ExecuteSingleCommand(cmd);

            int resultCount = this._unitOfWorkFactory
                .ExecuteSingleQuery<IGetCountQuery, int>(q => q.Execute<UserDto>());

            // Assert
            Assert.Equal(initialCount - 1, resultCount);
        }
        public void TestCleanup()
        {
            using (var unitOfWork = this.UnitOfWorkFactory.Create()) {
                var entities = unitOfWork.ResolveQuery<IGetAllQuery>()
                    .Execute<UserDto>();

                foreach (var entity in entities) {
                    var command = new RemoveUserCommand(entity.Id);
                    unitOfWork.ExecuteCommand(command);
                }

                unitOfWork.Commit();
            }
        }
        public ActionResult RemoveAccount(RemoveUserCommand command)
        {
            HandleCommand(command, Json("User removed"));

            return RedirectToAction("Index");
        }