public async Task SaveSubAccountGroup_Failure_NoParentMainAccountGroup() { var mainAccountGroupId = 666; var model = new Domain.Models.SubAccountGroup { Number = 19, Name = "Kassa och bank" }; var request = new SaveSubAccountGroupRequest(mainAccountGroupId, model); var handler = new SaveSubAccountGroupRequestHandler(_trackingContext, Mapper.Instance); var result = await handler.Handle(request, default(CancellationToken)); }
public async Task SaveSubAccountGroup_Success() { var expectedResultCount = 1; var dataGenerationResult1 = _trackingContext.AddTestData <Domain.Entities.MainAccountGroup>(expectedResultCount); Assert.IsTrue(dataGenerationResult1.Item1); var mainAccountGroupId = dataGenerationResult1.Item2[0]; var model = new Domain.Models.SubAccountGroup { Number = 19, Name = "Kassa och bank" }; var request = new SaveSubAccountGroupRequest(mainAccountGroupId, model); var handler = new SaveSubAccountGroupRequestHandler(_trackingContext, Mapper.Instance); var result = await handler.Handle(request, default(CancellationToken)); Assert.AreEqual(result, Unit.Value); }
public async Task SaveLedgerSubAccountGroup_Validation( string subAccountGroupName, int subAccountGroupNumber, int mainAccountGroupId, bool instantiateModel, bool isValid) { Domain.Models.SubAccountGroup model = null; if (instantiateModel) { model = new Domain.Models.SubAccountGroup { Number = subAccountGroupNumber, Name = subAccountGroupName }; } var request = new SaveSubAccountGroupRequest(mainAccountGroupId, model); var validator = new SaveSubAccountGroupValidator(); var validationResult = await validator.ValidateAsync(request); Assert.AreEqual(isValid, validationResult.IsValid); }
public async Task Create( int id, [FromBody] Domain.Models.SubAccountGroup model) { await _mediator.Send(new SaveSubAccountGroupRequest(id, model)); }