Beispiel #1
0
        public void ComplexTest(string email, string phone)
        {
            ComplexTest complex = new ComplexTest
            {
                emailString = email,
                phoneStr    = phone,
                testInt     = 33,
                testStr     = "strings strings",
                test        = new SimpleTest
                {
                    emailStr = email,
                    str      = "lorem test",
                    //strTwo = "heres another string"
                }
            };

            ShamWow.Processor.IShamWow processor = ShamWow.Processor.ShamWowEngine.GetFactory().Create(complex, Constants.ScrubMode.Marked);

            processor.Scrub();
            var cleanedData = (ComplexTest)processor.CleanData();

            Assert.NotEqual(cleanedData.emailString, email);
            Assert.NotEqual(cleanedData.test.emailStr, email);
            Assert.NotEqual(cleanedData.emailString, cleanedData.test.emailStr);
            Assert.NotEqual(phone, cleanedData.phoneStr);
            Assert.NotNull(cleanedData);
            Assert.IsType <ComplexTest>(cleanedData);
            Assert.True(processor.CheckManifest());
        }
Beispiel #2
0
        public void TestComplexStatefulModel(string randomStr, string anotherRandomStr, int num, int anotherNum)
        {
            var model = new ComplexStateTest
            {
                str        = randomStr,
                anotherStr = anotherRandomStr,
                anotherI   = anotherNum,
                i          = num
            };

            ShamWow.Processor.IShamWow processor = ShamWow.Processor.ShamWowEngine.GetFactory().Create(model, Constants.ScrubMode.Marked);

            processor.Scrub();
            var cleanedData = (ComplexStateTest)processor.CleanData();

            var man = processor.GetManifest();

            Assert.NotEqual(randomStr, cleanedData.str);
            Assert.NotEqual(anotherRandomStr, cleanedData.anotherStr);
            Assert.NotEqual(num, model.i);
            Assert.NotEqual(anotherNum, cleanedData.anotherI);
            Assert.Equal(cleanedData.str, cleanedData.anotherStr);
            Assert.Equal(cleanedData.i, cleanedData.anotherI);
            Assert.NotNull(cleanedData);
            Assert.IsType <ComplexStateTest>(cleanedData);
            Assert.True(processor.CheckManifest());
        }
Beispiel #3
0
        public void FullModelTest(string randomStr, string anotherRandomStr, int num, int anotherNum)
        {
            var model = new FullModelTest
            {
                anotherStateful  = randomStr,
                str              = anotherRandomStr,
                ComplexStateTest = new ComplexStateTest
                {
                    str        = randomStr,
                    anotherStr = anotherRandomStr,
                    anotherI   = anotherNum,
                    i          = num
                },
                SimpleTest = new SimpleTest
                {
                    str = "strings"
                },
                statefulTest = new StatefulTest
                {
                    i = num,
                    InnerStatefulTest = new InnerStatefulTest
                    {
                        anotherStateful = anotherRandomStr,
                        j = anotherNum
                    },
                    statefulString = randomStr,
                    str            = "strings"
                }
            };

            ShamWow.Processor.IShamWow processor = ShamWow.Processor.ShamWowEngine.GetFactory().Create(model, Constants.ScrubMode.Marked);
            processor.Scrub();
            var cleanedData = (FullModelTest)processor.CleanData();
            var man         = processor.GetManifest();

            //StateOne Asserts
            Assert.Equal(cleanedData.str, cleanedData.ComplexStateTest.str);
            Assert.Equal(cleanedData.ComplexStateTest.str, cleanedData.ComplexStateTest.anotherStr);
            Assert.NotEqual(anotherRandomStr, cleanedData.str);
            Assert.NotEqual(randomStr, cleanedData.ComplexStateTest.str);
            Assert.NotEqual(anotherRandomStr, cleanedData.ComplexStateTest.anotherStr);

            //emailStatfulScrub Asserts
            Assert.Equal(cleanedData.anotherStateful, cleanedData.statefulTest.statefulString);
            Assert.Equal(cleanedData.statefulTest.statefulString, cleanedData.statefulTest.InnerStatefulTest.anotherStateful);

            Assert.NotNull(cleanedData);
            Assert.IsType <FullModelTest>(cleanedData);
            Assert.True(processor.CheckManifest());
        }
Beispiel #4
0
        public void FullScrubModeTest(string email, string randString, string randStringTwo)
        {
            SimpleTest test = new SimpleTest
            {
                emailStr = email,
                str      = randString,
                Short    = 200,
                Date     = new System.DateTime(2018, 1, 1),
                Decimal  = 10.01m,
                Double   = 10.01d,
                Int      = 15,
                MyLong   = 323456789
            };

            ShamWow.Processor.IShamWow processor = ShamWow.Processor.ShamWowEngine.GetFactory().Create(test, Constants.ScrubMode.Marked);

            processor.Scrub();
            var cleanedData = (SimpleTest)processor.CleanData();

            Assert.NotEqual(cleanedData.emailStr, email);
            Assert.NotNull(cleanedData);
            Assert.IsType <SimpleTest>(cleanedData);
            Assert.True(processor.CheckManifest());
        }