Beispiel #1
0
        public void EnumConvertName()
        {
            var expectedEnum     = GenderTypeEnum.Male;
            var expectedEnumName = GenderTypeEnum.Male.Name;

            var convert = EntityFrameworkConverter.ToEnumName <GenderTypeEnum, int>();

            var actualEnum     = convert.ConvertFromProvider(expectedEnumName);
            var actualEnumName = convert.ConvertToProvider(expectedEnum);

            Assert.AreEqual(expectedEnum, actualEnum);
            Assert.AreEqual(expectedEnumName, actualEnumName);
        }
Beispiel #2
0
        public void StatusInactiveConvert()
        {
            var expectedEnum     = StatusEnum.Inactive;
            var expectedInactive = StatusEnum.Inactive.ToString();

            var convert = EntityFrameworkConverter.ToStatus();

            var actualEnum     = convert.ConvertFromProvider(expectedInactive);
            var actualInactive = convert.ConvertToProvider(expectedEnum);

            Assert.AreEqual(expectedEnum, actualEnum);
            Assert.AreEqual(expectedInactive, actualInactive);
        }
Beispiel #3
0
        public void NameConvert()
        {
            var value = "Juan pedro";

            var expectedEnum   = Name.Create(value);
            var expectedString = value;

            var convert = EntityFrameworkConverter.ToName <Name>();

            var actualEnum   = convert.ConvertFromProvider(expectedString);
            var actualString = convert.ConvertToProvider(expectedEnum);

            Assert.AreEqual(expectedEnum.ToString(), actualEnum.ToString());
            Assert.AreEqual(expectedString, actualString);
        }
Beispiel #4
0
        public void EmailConvert()
        {
            var value = "*****@*****.**";

            var expectedEnum   = Email.Create(value);
            var expectedString = value;

            var convert = EntityFrameworkConverter.ToEmail <Email>();

            var actualEnum   = convert.ConvertFromProvider(expectedString);
            var actualString = convert.ConvertToProvider(expectedEnum);

            Assert.AreEqual(expectedEnum.ToString(), actualEnum.ToString());
            Assert.AreEqual(expectedString, actualString);
        }
Beispiel #5
0
        public void SubdomainConvert()
        {
            var value = "documents"; // Ej. documents.kitpymes.com

            var expectedEnum   = Subdomain.Create(value);
            var expectedString = value;

            var convert = EntityFrameworkConverter.ToSubdomain <Subdomain>();

            var actualEnum   = convert.ConvertFromProvider(expectedString);
            var actualString = convert.ConvertToProvider(expectedEnum);

            Assert.AreEqual(expectedEnum.ToString(), actualEnum.ToString());
            Assert.AreEqual(expectedString, actualString);
        }