예제 #1
0
        public void TestViewModelDerive()
        {
            facetFactory.Process(Reflector, typeof(Class1), MethodRemover, Specification);
            var facet = Specification.GetFacet <IViewModelFacet>();

            Assert.IsNotNull(facet);

            var testClass = new Class1 {
                Value1 = "testValue1", Value2 = "testValue2"
            };
            var mock  = new Mock <INakedObjectAdapter>();
            var value = mock.Object;

            mock.Setup(no => no.Object).Returns(testClass);

            var key = facet.Derive(value, null, null, null, null);

            Assert.AreEqual(2, key.Length);
            Assert.AreEqual(testClass.Value1, key[0]);
            Assert.AreEqual(testClass.Value2, key[1]);
        }
        public void TestViewModelDerive()
        {
            IImmutableDictionary <string, ITypeSpecBuilder> metamodel = new Dictionary <string, ITypeSpecBuilder>().ToImmutableDictionary();

            metamodel = facetFactory.Process(Reflector, typeof(Class1), MethodRemover, Specification, metamodel);
            var facet = Specification.GetFacet <IViewModelFacet>();

            Assert.IsNotNull(facet);

            var testClass = new Class1 {
                Value1 = "testValue1", Value2 = "testValue2"
            };
            var mock = new Mock <INakedObjectAdapter>();
            INakedObjectAdapter value = mock.Object;

            mock.Setup(no => no.Object).Returns(testClass);

            string[] key = facet.Derive(value, null, null);

            Assert.AreEqual(2, key.Length);
            Assert.AreEqual(testClass.Value1, key[0]);
            Assert.AreEqual(testClass.Value2, key[1]);
            Assert.IsNotNull(metamodel);
        }