private PropertyGroup BuildPropertyGroup() => _builder .WithId(77) .WithName("Group1") .AddPropertyType() .WithId(3) .WithAlias("test") .WithName("Test") .WithDescription("testing") .WithPropertyGroupId(11) .WithMandatory(true) .WithValidationRegExp("xxxx") .Done() .AddPropertyType() .WithId(4) .WithAlias("test2") .WithName("Test2") .Done() .Build();
public void Is_Built_Correctly() { // Arrange const int testId = 77; var testKey = Guid.NewGuid(); const string testName = "Group1"; const int testSortOrder = 555; DateTime testCreateDate = DateTime.Now.AddHours(-1); DateTime testUpdateDate = DateTime.Now; const int testPropertyTypeId = 3; var builder = new PropertyGroupBuilder(); // Act PropertyGroup propertyGroup = builder .WithId(testId) .WithCreateDate(testCreateDate) .WithName(testName) .WithSortOrder(testSortOrder) .WithKey(testKey) .WithUpdateDate(testUpdateDate) .AddPropertyType() .WithId(3) .Done() .Build(); // Assert Assert.AreEqual(testId, propertyGroup.Id); Assert.AreEqual(testName, propertyGroup.Name); Assert.AreEqual(testSortOrder, propertyGroup.SortOrder); Assert.AreEqual(testCreateDate, propertyGroup.CreateDate); Assert.AreEqual(testUpdateDate, propertyGroup.UpdateDate); Assert.AreEqual(testKey, propertyGroup.Key); Assert.AreEqual(1, propertyGroup.PropertyTypes.Count); Assert.AreEqual(testPropertyTypeId, propertyGroup.PropertyTypes[0].Id); }