Beispiel #1
0
        public void DeleteCommand_Synchronous_Should_ReturnValidation_Result()
        {
            var service = new BusinessServiceBaseMock(new PersonProxyStub());
            var result  = service.DeleteCommand(0).Execute();

            result.Errors.Count().ShouldBe(1);
        }
Beispiel #2
0
        public async Task GetByIDCommand_Asynchronous_Should_Return_Validation_Result()
        {
            var service = new BusinessServiceBaseMock(new PersonProxyStub());
            var result  = await service.GetByIDCommand(0).ExecuteAsync();

            result.Errors.Count().ShouldBe(1);
        }
Beispiel #3
0
        public void UpdateCommand_Throws_DomainNotFoundException()
        {
            var proxy   = new PersonProxyStub();
            var service = new BusinessServiceBaseMock(proxy);

            service.UpdateCommand(new Person()).Execute();
        }
        public async Task DeleteCommandAsynchronousShouldReturnValidationResult()
        {
            var service = new BusinessServiceBaseMock(new PersonProxyStub());
            var result  = await service.DeleteCommand(0).ExecuteAsync();

            result.Errors.Count().ShouldBe(1);
        }
        public void GetByIDCommandSynchronousShouldReturnValidationResult()
        {
            var service = new BusinessServiceBaseMock(new PersonProxyStub());
            var result  = service.GetByIDCommand(0).Execute();

            result.Errors.Count().ShouldBe(1);
        }
        public async Task UpdateCommandAsync_Reverts_NonEditable_Values()
        {
            var proxy   = new PersonProxyStub();
            var service = new BusinessServiceBaseMock(proxy);
            var result  = await service.UpdateCommand(new Person { ID = 1, Name = "Frank Zappa", Version = "1" }).ExecuteAsync();

            result.Value.Name.ShouldBe("George Harrison");
        }
        public async Task DataProxy_UpdateAsync_Should_Be_Invoked()
        {
            var proxy   = new PersonProxyStub();
            var service = new BusinessServiceBaseMock(proxy);
            var result  = await service.UpdateCommand(new Person { ID = 1, ForeignKeyID = 0, Version = "1" }).ExecuteAsync();

            proxy.UpdateAsyncWasInvoked.ShouldBe(true);
        }
        public async Task LatencyProneShouldNotInvokeDataProxyGetByIDOnUpdateAsync()
        {
            var proxy   = new PersonProxyStub(isLatencyProne: true);
            var service = new BusinessServiceBaseMock(proxy);
            await service.UpdateCommand(new Person()).ExecuteAsync();

            proxy.GetByIDAsyncWasInvoked.ShouldBe(false);
        }
        public async Task UpdateCommandAsync_Reverts_PeasyForeignKey_Values()
        {
            var proxy   = new PersonProxyStub();
            var service = new BusinessServiceBaseMock(proxy);
            var result  = await service.UpdateCommand(new Person { ID = 1, ForeignKeyID = 0, Version = "1" }).ExecuteAsync();

            result.Value.ForeignKeyID.ShouldBe(null);
        }
Beispiel #10
0
        public void Latency_Prone_Should_Not_Invoke_DataProxy_GetByID_On_Update()
        {
            var proxy   = new PersonProxyStub(isLatencyProne: true);
            var service = new BusinessServiceBaseMock(proxy);

            service.UpdateCommand(new Person()).Execute();
            proxy.GetByIDWasInvoked.ShouldBe(false);
        }
        public async Task Non_Latency_Prone_Should_Not_Invoke_DataProxy_GetByID_On_UpdateAsync()
        {
            var proxy   = new PersonProxyStub(isLatencyProne: false);
            var service = new BusinessServiceBaseMock(proxy);
            await service.UpdateCommand(new Person { ID = 1, Version = "1" }).ExecuteAsync();

            proxy.GetByIDAsyncWasInvoked.ShouldBe(true);
        }
Beispiel #12
0
 public async Task UpdateCommandAsync_Throws_ConcurrencyException()
 {
     var proxy   = new PersonProxyStub();
     var service = new BusinessServiceBaseMock(proxy);
     await service.UpdateCommand(new Person()
     {
         ID = 1, Version = "2"
     }).ExecuteAsync();
 }
        public void UpdateCommand_Throws_ConcurrencyException()
        {
            var proxy   = new PersonProxyStub();
            var service = new BusinessServiceBaseMock(proxy);

            service.UpdateCommand(new Person {
                ID = 1, Version = "2"
            }).Execute();
        }
Beispiel #14
0
        public void DataProxy_Update_Should_Be_Invoked()
        {
            var proxy   = new PersonProxyStub();
            var service = new BusinessServiceBaseMock(proxy);
            var result  = service.UpdateCommand(new Person()
            {
                ID = 1, ForeignKeyID = 0, Version = "1"
            }).Execute();

            proxy.UpdateWasInvoked.ShouldBe(true);
        }
        public void UpdateCommandRevertsPeasyForeignKeyValues()
        {
            var proxy   = new PersonProxyStub();
            var service = new BusinessServiceBaseMock(proxy);
            var result  = service.UpdateCommand(new Person()
            {
                ID = 1, ForeignKeyID = 0, Version = "1"
            }).Execute();

            result.Value.ForeignKeyID.ShouldBe(null);
        }
Beispiel #16
0
        public void UpdateCommand_Reverts_Non_Editable_Values()
        {
            var proxy   = new PersonProxyStub();
            var service = new BusinessServiceBaseMock(proxy);
            var result  = service.UpdateCommand(new Person()
            {
                ID = 1, Name = "Frank Zappa", Version = "1"
            }).Execute();

            result.Value.Name.ShouldBe("George Harrison");
        }
        public void NonLatencyProneShouldNotInvokeDataProxyGetByIDOnUpdate()
        {
            var proxy   = new PersonProxyStub(isLatencyProne: false);
            var service = new BusinessServiceBaseMock(proxy);

            service.UpdateCommand(new Person()
            {
                ID = 1, Version = "1"
            }).Execute();
            proxy.GetByIDWasInvoked.ShouldBe(true);
        }
Beispiel #18
0
 public async Task UpdateCommandAsync_Throws_DomainNotFoundException()
 {
     var proxy   = new PersonProxyStub();
     var service = new BusinessServiceBaseMock(proxy);
     await service.UpdateCommand(new Person()).ExecuteAsync();
 }