コード例 #1
0
 public void Autogenerate()
 {
     foreach (var processType in EnumsHelper.GetEnumList <TProcessEnum>())
     {
         Add(processType);
     }
 }
コード例 #2
0
        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))));
        }
コード例 #3
0
        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));
        }
コード例 #4
0
        public void Given_KnownEnumType_When_GetEnumListInvoked_Then_EnumListRetrived()
        {
            var enumList = EnumsHelper.GetEnumList <TestEnum>();

            Assert.AreEqual(enumList.Count(), 3);
        }
コード例 #5
0
 public void Given_WrongEnumType_When_GetEnumListInvoked_Then_ExceptionThrown()
 {
     Assert.ThrowsException <ArgumentException>(() => EnumsHelper.GetEnumList <DateTime>());
 }