public static void NoConversionTest() { CamelCaseDummyA camelCaseDummyA = new CamelCaseDummyA(); camelCaseDummyA.LoadDefaults(); CamelCaseDummyB camelCaseDummyB = new CamelCaseDummyB(); Copier copier = new Copier(); copier.Copy(camelCaseDummyA, camelCaseDummyB); Assert.Equal(camelCaseDummyA.DummyString, camelCaseDummyB.DummyString); Assert.Equal(camelCaseDummyA.DummyInt, camelCaseDummyB.DummyInt); Assert.Equal(camelCaseDummyA.DummyDouble, camelCaseDummyB.DummyDouble); Assert.Equal(camelCaseDummyA.DummyImage.Height, camelCaseDummyB.DummyImage.Height); Assert.Equal(camelCaseDummyA.DummyImage.Width, camelCaseDummyB.DummyImage.Width); Assert.Equal(camelCaseDummyA.DummyImage.Data, camelCaseDummyB.DummyImage.Data); Assert.NotEqual(camelCaseDummyA.SpecificDummyA, camelCaseDummyB.SpecificDummyB); }
public static void SnakeToCamelTest() { SnakeCaseDummyA snakeCaseDummyA = new SnakeCaseDummyA(); snakeCaseDummyA.LoadDefaults(); CamelCaseDummyB camelCaseDummyB = new CamelCaseDummyB(); Copier copier = new Copier(); copier.Copy(snakeCaseDummyA, camelCaseDummyB); Assert.Equal(snakeCaseDummyA.dummy_string, camelCaseDummyB.DummyString); Assert.Equal(snakeCaseDummyA.dummy_int, camelCaseDummyB.DummyInt); Assert.Equal(snakeCaseDummyA.dummy_double, camelCaseDummyB.DummyDouble); Assert.Equal(snakeCaseDummyA.dummy_image.Height, camelCaseDummyB.DummyImage.Height); Assert.Equal(snakeCaseDummyA.dummy_image.Width, camelCaseDummyB.DummyImage.Width); Assert.Equal(snakeCaseDummyA.dummy_image.Data, camelCaseDummyB.DummyImage.Data); Assert.NotEqual(snakeCaseDummyA.specific_dummy_a, camelCaseDummyB.SpecificDummyB); }
public static void CopierHelperTest() { CamelCaseDummyA camelCaseDummyA = new CamelCaseDummyA(); camelCaseDummyA.LoadDefaults(); CamelCaseDummyB camelCaseDummyB = new CamelCaseDummyB(); camelCaseDummyB.CopyToOtherClass(camelCaseDummyA); Assert.True(camelCaseDummyA.DummyString == camelCaseDummyB.DummyString); Assert.True(camelCaseDummyA.DummyInt == camelCaseDummyB.DummyInt); Assert.True(Math.Abs(camelCaseDummyA.DummyDouble - camelCaseDummyB.DummyDouble) < 0.01); Assert.True(camelCaseDummyA.DummyImage.Height == camelCaseDummyB.DummyImage.Height); Assert.True(camelCaseDummyA.DummyImage.Width == camelCaseDummyB.DummyImage.Width); Assert.True(camelCaseDummyA.DummyImage.Data == camelCaseDummyB.DummyImage.Data); Assert.True(camelCaseDummyA.SpecificDummyA != camelCaseDummyB.SpecificDummyB); }