예제 #1
0
 /// <summary>
 /// Populates model with JSON string of serialized ClientStatus enum values
 /// </summary>
 /// <returns>Home View Model</returns>
 private static HomeViewModel PopulateViewModelWithEnumValues()
 {
     return(new HomeViewModel
     {
         ClientStatusJson = EnumHelpers.ConvertToJsonDictionary <ClientStatus>()
     });
 }
예제 #2
0
        public void ConvertToJsonDictionary_ShouldThrowArgumentException_WhenTypeIsInt()
        {
            // Arrange
            // Act
            Action action = () => EnumHelpers.ConvertToJsonDictionary <int>();

            // Assert
            action.ShouldThrow <ArgumentException>();
        }
예제 #3
0
        public void ConvertToJsonDictionary_ShouldReturnEnumSerializedIntoJson_WhenTypeIsEnum()
        {
            // Arrange
            var expectedResult = $"{{\"{TestEnum.Item1}\":{(int)TestEnum.Item1},\"{TestEnum.Item2}\":{(int)TestEnum.Item2}}}";

            // Act
            var result = EnumHelpers.ConvertToJsonDictionary <TestEnum>();

            // Assert
            result.Should().Be(expectedResult);
        }