Exemplo n.º 1
0
        public void BaseTemplate_MergedDate_HasCustomDataOverwritingDefaultData_ReturnCustom()
        {
            TestIdentityTemplate template = new TestIdentityTemplate
            {
                { "DefaultColumnA", 3001 }
            };

            Assert.AreEqual(3001, template.MergedData["DefaultColumnA"]);
        }
Exemplo n.º 2
0
        public void BaseTemplate_CustomData_RetrieveDataSetDuringSetup()
        {
            TestIdentityTemplate template = new TestIdentityTemplate
            {
                { "DomainId", 1001 },
                { "UserId", 2001 }
            };

            Assert.AreEqual(2001, template.CustomData["UserId"]);
        }
        public void BaseIdentityTemplate_Identity_RetrieveCorrectValue()
        {
            TestIdentityTemplate template = new TestIdentityTemplate
            {
                { "DomainId", 1001 },
                { "UserId", 2001 }
            };

            Assert.AreEqual(2001, template.Identity);
        }
        public void BaseIdentityTemplate_IdentityColumnNotSet_Error()
        {
            TestIdentityTemplate template = new TestIdentityTemplate
            {
                { "DomainId", 1001 }
            };

            var exception = Assert.Throws <KeyNotFoundException>(() => { int value = template.Identity; });

            Assert.AreEqual("UserId was not found in the data set", exception.Message);
        }
Exemplo n.º 5
0
        public void BaseTemplate_MergedDate_HasCustomData_ReturnDefaultAndCustom()
        {
            TestIdentityTemplate template = new TestIdentityTemplate
            {
                { "DomainId", 1001 },
                { "UserId", 2001 }
            };

            Assert.AreEqual(1001, template.MergedData["DomainId"]);
            Assert.AreEqual(2001, template.MergedData["UserId"]);
            Assert.AreEqual(9001, template.MergedData["DefaultColumnA"]);
        }
Exemplo n.º 6
0
        public void BaseTemplate_Ctor_CanInstantiateFromExistingTemplate()
        {
            TestIdentityTemplate template = new TestIdentityTemplate
            {
                { "DomainId", 1001 },
                { "UserId", 2001 }
            };

            TestIdentityTemplate newTemplate = new TestIdentityTemplate(template);

            Assert.AreEqual(1001, newTemplate.CustomData["DomainId"]);
            Assert.AreEqual(2001, newTemplate.CustomData["UserId"]);
            Assert.AreEqual(9001, newTemplate.DefaultData["DefaultColumnA"]);
        }
        public void BaseIdentityTemplate_IdentityResolver_RetrieveCorrectValue()
        {
            TestIdentityTemplate template = new TestIdentityTemplate
            {
                { "DomainId", 1001 },
                { "UserId", 2001 }
            };

            Resolver <int> resolver = template.IdentityResolver;

            Assert.IsNotNull(resolver);

            Assert.AreEqual(2001, resolver.Resolve());
        }
        public void BaseIdentityTemplate_IdentityColumnNotSet_IdentityResolver_ErrorDuringResolveOnly()
        {
            TestIdentityTemplate template = new TestIdentityTemplate
            {
                { "DomainId", 1001 }
            };

            Resolver <int> resolver = template.IdentityResolver;

            Assert.IsNotNull(resolver);

            var exception = Assert.Throws <KeyNotFoundException>(() => { object value = resolver.Resolve(); });

            Assert.AreEqual("UserId was not found in the data set", exception.Message);
        }
Exemplo n.º 9
0
        public void BaseTemplate_MergedDate_NoCustomData_ReturnDefaultOnly()
        {
            TestIdentityTemplate template = new TestIdentityTemplate();

            Assert.AreEqual(9001, template.MergedData["DefaultColumnA"]);
        }
Exemplo n.º 10
0
        public void BaseTemplate_DefaultCtor()
        {
            TestIdentityTemplate template = new TestIdentityTemplate();

            Assert.AreEqual(0, template.CustomData.Count);
        }