public void Autogenerate() { foreach (var processType in EnumsHelper.GetEnumList <TProcessEnum>()) { Add(processType); } }
public void Given_FullEnumTypeWithDescriptions_When_Add_Then_AllProcessDefinitionWithNameAndDescriptionCreated() { var builder = new ProcessDefinitionBuilder <int, TestUndefinedProcesses>(); var expectedList = EnumsHelper.GetEnumList <TestUndefinedProcesses>(); builder.Autogenerate(); Assert.AreEqual(builder.Count, expectedList.Count()); Assert.IsTrue(builder.Definitions.Any(x => expectedList.Contains(EnumsHelper.GetByString <TestUndefinedProcesses>(x.Name)))); Assert.IsTrue(builder.Definitions.Any(x => expectedList.Contains(EnumsHelper.GetByDescription <TestUndefinedProcesses>(x.Description)))); }
public void Given_EnumWithProcessDefinitionAttributes_When_Add_Then_AllProcessDefinitionWithNameDescriptionAndTypeCreated() { var builder = new ProcessDefinitionBuilder <int, TestExtraDefinedProcesses>(); var expectedList = EnumsHelper.GetEnumList <TestExtraDefinedProcesses>(); builder.Autogenerate(); Assert.AreEqual(builder.Count, expectedList.Count()); Assert.IsTrue(builder.Definitions.Any(x => expectedList.Contains(EnumsHelper.GetByString <TestExtraDefinedProcesses>(x.Name)))); Assert.IsTrue(builder.Definitions.Any(x => expectedList.Contains(EnumsHelper.GetByDescription <TestExtraDefinedProcesses>(x.Description)))); Assert.IsTrue(builder.Definitions.Any(x => x.Type == Enums.ProcessType.Background)); Assert.IsTrue(builder.Definitions.Any(x => x.Type == Enums.ProcessType.Batch)); }
public void Given_KnownEnumType_When_GetEnumListInvoked_Then_EnumListRetrived() { var enumList = EnumsHelper.GetEnumList <TestEnum>(); Assert.AreEqual(enumList.Count(), 3); }
public void Given_WrongEnumType_When_GetEnumListInvoked_Then_ExceptionThrown() { Assert.ThrowsException <ArgumentException>(() => EnumsHelper.GetEnumList <DateTime>()); }