Пример #1
0
        public void DeserializeAllSetupDataTest()
        {
            //var xxx = TestDataProvider.BuildParametersXml();
            // std, EmptyBuildParameters
            var xml = TestDataProvider.BuildParametersMinimalDefaultMethodEraserXml();

            //Server.Default.LambdaFormatter = Console.Out;
            Server.Default.LambdaFormatter = global::Gallio.Framework.TestLog.Warnings;
            //Server.ToConsoleOut();

            Expect.Call(handler.Type).Return(typeof(string));
            mocks.ReplayAll();

            var result = testObject.DeserializeAllSetupData(xml, properties, new[] { handler });

            //typeof(BuilderSerializerTest).Assembly.Dump(3);
            //result.Dump("Headline", 15);
            //global::Gallio.Framework.TestLog.ConsoleOutput.WriteLine("Arscg");
            //global::Gallio.Framework.TestLog.Warnings.WriteLine("Arscg");
            //var xx = properties;
            // Assert.IsEmpty(result, "VAR: {0}", "Moo");

            //var xxx = Assert.XmlSerialize(result.First());
            //var xxx = Assert.XmlSerialize(new EmptyMultiBuildParameters());
            //Assert.AreEqual("", xxx);

            // Assert.AreElementsSame(new[] { new EmptyBuildParameters() }, result);
            mocks.VerifyAll();
        }
Пример #2
0
        public void DeserializeAllSetupDataWithWrongXmlTypeThrows()
        {
            var xml = TestDataProvider.BuildParametersMinimalDefaultMethodEraserXml();

            Expect.Call(handler.Type).Return(typeof(DefaultMethodEraser)).Repeat.Any();
            Expect.Call(handler.IsMultiBuilder).Return(false).Repeat.Any();
            Expect.Call(handler.ParameterDataType).Return(typeof(EmptyMultiBuildParameters)).Repeat.Any();
            mocks.ReplayAll();
            Assert.Throws <ArgumentOutOfRangeException>(() => testObject.DeserializeAllSetupData(xml, properties, new[] { handler }));
            mocks.VerifyAll();
        }
Пример #3
0
        public void DeserializeAllSetupDataMinimalDefaultMethodEraserNotPresentHandlerParameterType()
        {
            var xml = TestDataProvider.BuildParametersMinimalDefaultMethodEraserXml();

            // In case no matching handler is found, EmptyBuildParameters has to be instantiated and returned.
            Expect.Call(handler.Type).Return(typeof(string));
            mocks.ReplayAll();
            var result = testObject.DeserializeAllSetupData(xml, properties, new[] { handler });

            Assert.AreElementsEqual(new[] { new EmptyBuildParameters() }, result);
            mocks.VerifyAll();
        }
Пример #4
0
        public void DeserializeAllSetupDataMinimalDefaultMethodEraser()
        {
            var xml = TestDataProvider.BuildParametersMinimalDefaultMethodEraserXml();

            Expect.Call(handler.Type).Return(typeof(EmptyBuildParameters));
            mocks.ReplayAll();
            var result = testObject.DeserializeAllSetupData(xml, properties, new[] { handler });

            Assert.AreElementsEqual(new[] { new EmptyBuildParameters() }, result);
            Assert.IsEmpty(properties.General.Keys);
            mocks.VerifyAll();
        }
Пример #5
0
        public void DeserializeAllSetupDataWithPropertyBuilder()
        {
            // <NStub.CSharp.ObjectGeneration.Builders.DefaultMethodEraser><EmptyBuildParameters>
            var xml = TestDataProvider.BuildParametersMinimalDefaultMethodEraserXml();

            Expect.Call(handler.Type).Return(typeof(DefaultMethodEraser)).Repeat.Any();
            Expect.Call(handler.IsMultiBuilder).Return(false).Repeat.Any();
            Expect.Call(handler.ParameterDataType).Return(typeof(string)).Repeat.Any();
            mocks.ReplayAll();
            var result = testObject.DeserializeAllSetupData(xml, properties, new[] { handler });

            Assert.AreElementsSame(new[] { new EmptyBuildParameters() }, result);
            mocks.VerifyAll();
        }
Пример #6
0
        public void DetermineIMemberBuilderFromXmlFragmentTest()
        {
            // <NStub.CSharp.ObjectGeneration.Builders.DefaultMethodEraser><EmptyBuildParameters>
            var fragment = GetBuildParametersFragment(TestDataProvider.BuildParametersMinimalDefaultMethodEraserXml());
            var xml      = fragment.InnerXml;

            // Todo: hier weiter
            Expect.Call(handler.Type).Return(typeof(DefaultMethodEraser)).Repeat.Any();
            Expect.Call(handler.IsMultiBuilder).Return(false).Repeat.Any();
            Expect.Call(handler.ParameterDataType).Return(typeof(string)).Repeat.Any();
            mocks.ReplayAll();
            var result = testObject.DetermineIMemberBuilderFromXmlFragment(xml, new[] { handler });

            Assert.AreSame(handler, result);
            mocks.VerifyAll();
        }
Пример #7
0
        public void DeserializeAllSetupDataWithEmptyBuildParametersHandlerParameterDataType()
        {
            // <NStub.CSharp.ObjectGeneration.Builders.DefaultMethodEraser><EmptyBuildParameters>
            var xml = TestDataProvider.BuildParametersMinimalDefaultMethodEraserXml();

            Expect.Call(handler.Type).Return(typeof(DefaultMethodEraser)).Repeat.Any();
            Expect.Call(handler.IsMultiBuilder).Return(false).Repeat.Any();
            //Expect.Call(handler.ParameterDataType).Return(typeof(string)).Repeat.Any();
            Expect.Call(handler.ParameterDataType).Return(typeof(EmptyBuildParameters)).Repeat.Any();
            mocks.ReplayAll();
            var result   = testObject.DeserializeAllSetupData(xml, properties, new[] { handler });
            var expected = new EmptyBuildParameters();

            expected.Enabled = true;
            Assert.AreElementsEqual(new[] { expected }, result,
                                    (x, y) => x.Enabled == y.Enabled && x.GetType() == y.GetType());
            mocks.VerifyAll();
        }