QuellCode/CentronERP war nur als Gitlink (Submodul-Referenz auf 79c1142) getrackt, ohne .gitmodules und ohne erreichbares Remote. Der Untersuchungsgegenstand der Versuchsreihe war damit nicht reproduzierbar gesichert: Ein Klon haette ein leeres Verzeichnis erhalten, und die Belege der 3.287 Anforderungen waeren nicht ueberpruefbar gewesen. Umstellung: - Historie nach c:\DEV\CentronERP_git_snapshot_79c1142 ausgelagert (vollstaendig lesbar, enthaelt 79c1142 und Vorgaenger 89ccfd6) - Gitlink aus dem Index entfernt - Dateiinhalt aufgenommen: 24.557 Dateien, rund 333 MB Die verschachtelte .gitignore der Codebasis gilt weiter, Build-Artefakte bleiben ausgeschlossen. Details in Versuche/Versuch_01/_Codebasis-Nachweis.md
288 lines
12 KiB
C#
288 lines
12 KiB
C#
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using Centron.BusinessLogic;
|
|
using Centron.BusinessLogic.Administration.Customization;
|
|
using Centron.BusinessLogic.WebServices.Accounts;
|
|
using Centron.Data.Entities.Administration.Customization;
|
|
using Centron.Interfaces;
|
|
using Centron.Interfaces.Accounts;
|
|
using Centron.Interfaces.Administration.Customization;
|
|
using Centron.Interfaces.BL;
|
|
using Centron.Tests.EndToEnd.Infrastructure;
|
|
using Xunit;
|
|
using Xunit.Abstractions;
|
|
|
|
namespace Centron.Tests.EndToEnd.Tests.Administration.Customization;
|
|
|
|
public class AccountSearchCustomPropertiesTests : EndToEndTest
|
|
{
|
|
public AccountSearchCustomPropertiesTests(ITestOutputHelper testOutputHelper) : base(testOutputHelper)
|
|
{
|
|
}
|
|
|
|
public override void Execute()
|
|
{
|
|
var properties = PrepareAdditionalProperties();
|
|
PrepareAccountsWithCustomProperties(properties);
|
|
|
|
ExecuteAccountSearch("Search term 'Wasserschaden'", new AccountSearchFilter()
|
|
{
|
|
IsActive = true,
|
|
SearchText = "Wasserschaden"
|
|
}, new List<int>() { 4, 7 });
|
|
|
|
ExecuteAccountSearch("Search term 'C#'", new AccountSearchFilter()
|
|
{
|
|
IsActive = true,
|
|
SearchText = "C#"
|
|
}, new List<int>() { 16 });
|
|
|
|
ExecuteAccountSearch("Custom property Text 'Überflutung'", new AccountSearchFilter()
|
|
{
|
|
IsActive = true,
|
|
CustomPropertyFilterItems = new List<ModuleCustomPropertyFilterItem>()
|
|
{
|
|
new ModuleCustomPropertyFilterItem()
|
|
{
|
|
ModuleCustomPropertyI3D = properties.First(f => f.Name == "Zusatzfeld Text").I3D,
|
|
DataType = CustomizationDataTypes.Text,
|
|
Value = "Überflutung"
|
|
}
|
|
}
|
|
}, new List<int>() { 16 });
|
|
|
|
ExecuteAccountSearch("Custom property Text 'Hochwasser'", new AccountSearchFilter()
|
|
{
|
|
IsActive = true,
|
|
CustomPropertyFilterItems = new List<ModuleCustomPropertyFilterItem>()
|
|
{
|
|
new ModuleCustomPropertyFilterItem()
|
|
{
|
|
ModuleCustomPropertyI3D = properties.First(f => f.Name == "Zusatzfeld Text").I3D,
|
|
DataType = CustomizationDataTypes.Text,
|
|
Value = "Hochwasser"
|
|
}
|
|
}
|
|
}, new List<int>() { });
|
|
|
|
ExecuteAccountSearch("Custom property Integer '16'", new AccountSearchFilter()
|
|
{
|
|
IsActive = true,
|
|
CustomPropertyFilterItems = new List<ModuleCustomPropertyFilterItem>()
|
|
{
|
|
new ModuleCustomPropertyFilterItem()
|
|
{
|
|
ModuleCustomPropertyI3D = properties.First(f => f.Name == "Zusatzfeld Integer").I3D,
|
|
DataType = CustomizationDataTypes.Integer,
|
|
Value = "16"
|
|
}
|
|
}
|
|
}, new List<int>() { 16 });
|
|
|
|
ExecuteAccountSearch("Custom property ComboBox 'Web Tools'", new AccountSearchFilter()
|
|
{
|
|
IsActive = true,
|
|
CustomPropertyFilterItems = new List<ModuleCustomPropertyFilterItem>()
|
|
{
|
|
new ModuleCustomPropertyFilterItem()
|
|
{
|
|
ModuleCustomPropertyI3D = properties.First(f => f.Name == "Zusatzfeld ComboBox").I3D,
|
|
DataType = CustomizationDataTypes.ComboBox,
|
|
Value = properties.First(f => f.Name == "Zusatzfeld ComboBox").PossibleValues.First().I3D
|
|
}
|
|
}
|
|
}, new List<int>() { 4, 7 });
|
|
|
|
ExecuteAccountSearch("Custom property Boolean 'false'", new AccountSearchFilter()
|
|
{
|
|
IsActive = true,
|
|
CustomPropertyFilterItems = new List<ModuleCustomPropertyFilterItem>()
|
|
{
|
|
new ModuleCustomPropertyFilterItem()
|
|
{
|
|
ModuleCustomPropertyI3D = properties.First(f => f.Name == "Zusatzfeld Boolean").I3D,
|
|
DataType = CustomizationDataTypes.Boolean,
|
|
Value = false
|
|
}
|
|
}
|
|
}, new List<int>() { 1036 });
|
|
|
|
ExecuteAccountSearch("Search without custom properties", new AccountSearchFilter()
|
|
{
|
|
IsActive = true,
|
|
SearchText = "Sparkasse Ulm"
|
|
}, new List<int>() { 11 });
|
|
}
|
|
|
|
private void ExecuteAccountSearch(string checkCaption, AccountSearchFilter filter, List<int> shouldHaveAccountI3Ds)
|
|
{
|
|
using var session = new BLSession();
|
|
var searchResult = session.GetBL<AccountSearchWebServiceBL>().SearchAccountsThroughPaging(base.GetLoggedInUser(),filter, 1, int.MaxValue).ThrowIfError();
|
|
|
|
if (!shouldHaveAccountI3Ds.Any())
|
|
{
|
|
Assert.True(!searchResult.Result.Any(), checkCaption);
|
|
}
|
|
else
|
|
{
|
|
Assert.True(searchResult.Result.All(f => shouldHaveAccountI3Ds.Contains(f.I3D)), checkCaption);
|
|
}
|
|
}
|
|
|
|
private List<ModuleCustomProperty> PrepareAdditionalProperties()
|
|
{
|
|
using var session = new BLSession();
|
|
|
|
var properties = new List<ModuleCustomProperty>()
|
|
{
|
|
new ModuleCustomProperty()
|
|
{
|
|
Name = "Zusatzfeld Text",
|
|
Category = "Allgemein",
|
|
DataType = CustomizationDataTypes.Text,
|
|
ObjectI3D = 0,
|
|
ObjectKind = CentronObjectKindNumeric.Account,
|
|
IsVisible = true,
|
|
SortOrder = 0
|
|
},
|
|
new ModuleCustomProperty()
|
|
{
|
|
Name = "Zusatzfeld ComboBox",
|
|
Category = "Allgemein",
|
|
DataType = CustomizationDataTypes.ComboBox,
|
|
ObjectI3D = 0,
|
|
ObjectKind = CentronObjectKindNumeric.Account,
|
|
IsVisible = true,
|
|
SortOrder = 0,
|
|
PossibleValues = new List<ModuleCustomPropertyPossibleValue>()
|
|
{
|
|
new ModuleCustomPropertyPossibleValue()
|
|
{
|
|
Value = "Web Tools",
|
|
IsVisible = true
|
|
},
|
|
new ModuleCustomPropertyPossibleValue()
|
|
{
|
|
Value = "C#",
|
|
IsVisible = true
|
|
}
|
|
}
|
|
},
|
|
new ModuleCustomProperty()
|
|
{
|
|
Name = "Zusatzfeld Boolean",
|
|
Category = "Allgemein",
|
|
DataType = CustomizationDataTypes.Boolean,
|
|
ObjectI3D = 0,
|
|
ObjectKind = CentronObjectKindNumeric.Account,
|
|
IsVisible = true,
|
|
SortOrder = 0
|
|
},
|
|
new ModuleCustomProperty()
|
|
{
|
|
Name = "Zusatzfeld Integer",
|
|
Category = "Allgemein",
|
|
DataType = CustomizationDataTypes.Integer,
|
|
ObjectI3D = 0,
|
|
ObjectKind = CentronObjectKindNumeric.Account,
|
|
IsVisible = true,
|
|
SortOrder = 0
|
|
}
|
|
};
|
|
|
|
session.GetBL<ModuleCustomPropertyBL>().SaveCustomPropertyStructure(base.GetLoggedInUser(), properties, CentronObjectKindNumeric.Account).ThrowIfError();
|
|
return properties;
|
|
}
|
|
|
|
private void PrepareAccountsWithCustomProperties(List<ModuleCustomProperty> properties)
|
|
{
|
|
using var session = new BLSession();
|
|
session.GetBL<ModuleCustomPropertyValueBL>().SaveCustomPropertyValues(base.GetLoggedInUser(), 4,
|
|
CentronObjectKindNumeric.Account,
|
|
new List<ModuleCustomPropertyValue>()
|
|
{
|
|
new ModuleCustomPropertyValue()
|
|
{
|
|
ModuleCustomPropertyI3D = properties.First(f => f.Name == "Zusatzfeld Text").I3D,
|
|
ObjectI3D = 4,
|
|
ObjectKind = CentronObjectKindNumeric.Account,
|
|
ValueText = "Wasserschaden"
|
|
},
|
|
new ModuleCustomPropertyValue()
|
|
{
|
|
ModuleCustomPropertyI3D = properties.First(f => f.Name == "Zusatzfeld ComboBox").I3D,
|
|
ObjectI3D = 4,
|
|
ObjectKind = CentronObjectKindNumeric.Account,
|
|
ValueInteger = properties.First(f => f.Name == "Zusatzfeld ComboBox").PossibleValues.First().I3D
|
|
},
|
|
});
|
|
|
|
session.GetBL<ModuleCustomPropertyValueBL>().SaveCustomPropertyValues(base.GetLoggedInUser(), 7,
|
|
CentronObjectKindNumeric.Account,
|
|
new List<ModuleCustomPropertyValue>()
|
|
{
|
|
new ModuleCustomPropertyValue()
|
|
{
|
|
ModuleCustomPropertyI3D = properties.First(f => f.Name == "Zusatzfeld Text").I3D,
|
|
ObjectI3D = 7,
|
|
ObjectKind = CentronObjectKindNumeric.Account,
|
|
ValueText = "Wasserschaden"
|
|
},
|
|
new ModuleCustomPropertyValue()
|
|
{
|
|
ModuleCustomPropertyI3D = properties.First(f => f.Name == "Zusatzfeld ComboBox").I3D,
|
|
ObjectI3D = 7,
|
|
ObjectKind = CentronObjectKindNumeric.Account,
|
|
ValueInteger = properties.First(f => f.Name == "Zusatzfeld ComboBox").PossibleValues.First().I3D
|
|
},
|
|
});
|
|
|
|
session.GetBL<ModuleCustomPropertyValueBL>().SaveCustomPropertyValues(base.GetLoggedInUser(), 16,
|
|
CentronObjectKindNumeric.Account,
|
|
new List<ModuleCustomPropertyValue>()
|
|
{
|
|
new ModuleCustomPropertyValue()
|
|
{
|
|
ModuleCustomPropertyI3D = properties.First(f => f.Name == "Zusatzfeld Text").I3D,
|
|
ObjectI3D = 16,
|
|
ObjectKind = CentronObjectKindNumeric.Account,
|
|
ValueText = "Überflutung des Kellers"
|
|
},
|
|
new ModuleCustomPropertyValue()
|
|
{
|
|
ModuleCustomPropertyI3D = properties.First(f => f.Name == "Zusatzfeld ComboBox").I3D,
|
|
ObjectI3D = 16,
|
|
ObjectKind = CentronObjectKindNumeric.Account,
|
|
ValueInteger = properties.First(f => f.Name == "Zusatzfeld ComboBox").PossibleValues.Last().I3D
|
|
},
|
|
new ModuleCustomPropertyValue()
|
|
{
|
|
ModuleCustomPropertyI3D = properties.First(f => f.Name == "Zusatzfeld Integer").I3D,
|
|
ObjectI3D = 16,
|
|
ObjectKind = CentronObjectKindNumeric.Account,
|
|
ValueInteger = 16
|
|
},
|
|
new ModuleCustomPropertyValue()
|
|
{
|
|
ModuleCustomPropertyI3D = properties.First(f => f.Name == "Zusatzfeld Boolean").I3D,
|
|
ObjectI3D = 16,
|
|
ObjectKind = CentronObjectKindNumeric.Account,
|
|
ValueBoolean = true
|
|
}
|
|
});
|
|
|
|
session.GetBL<ModuleCustomPropertyValueBL>().SaveCustomPropertyValues(base.GetLoggedInUser(), 1036,
|
|
CentronObjectKindNumeric.Account,
|
|
new List<ModuleCustomPropertyValue>()
|
|
{
|
|
|
|
new ModuleCustomPropertyValue()
|
|
{
|
|
ModuleCustomPropertyI3D = properties.First(f => f.Name == "Zusatzfeld Boolean").I3D,
|
|
ObjectI3D = 1036,
|
|
ObjectKind = CentronObjectKindNumeric.Account,
|
|
ValueBoolean = false
|
|
}
|
|
});
|
|
}
|
|
} |