public void SimpleItemWithDontSerializeAttributeConvertsToGenericTableEntityCorrectly()
        {
            var itemToSave = new SimpleItemWithDontSerializeAttribute
            {
                SerializedString    = "foo",
                NotSerializedString = "bar"
            };
            TableItem tableItem = TableItem.Create(itemToSave, "pk", "rk");

            var genericItemToTest = GenericTableEntity.HydrateFrom(tableItem);


            var wereCool = true;


            wereCool &= itemToSave.SerializedString == genericItemToTest.WriteEntity(null)["SerializedString"].StringValue;

            try
            {
                wereCool &= null == genericItemToTest.WriteEntity(null)["NotSerializedString"].StringValue;
            }
            catch (KeyNotFoundException)
            {
                wereCool &= true;
            }

            wereCool &= genericItemToTest.WriteEntity(null).Count == 1;

            Assert.IsTrue(wereCool);
        }
Beispiel #2
0
        public void SimpleItemWithDontSerializeAttributeConvertsToGenericTableEntityCorrectly()
        {
            var itemToSave = new SimpleItemWithDontSerializeAttribute
                          {
                             SerializedString = "foo",
                             NotSerializedString = "bar"
                          };
             TableItem tableItem = TableItem.Create( itemToSave, "pk", "rk" );

             var genericItemToTest = GenericTableEntity.HydrateFrom( tableItem );

             var wereCool = true;

             wereCool &= itemToSave.SerializedString == genericItemToTest.WriteEntity( null )["SerializedString"].StringValue;

             try
             {
            wereCool &= null == genericItemToTest.WriteEntity( null )["NotSerializedString"].StringValue;
             }
             catch ( KeyNotFoundException )
             {
            wereCool &= true;
             }

             wereCool &= genericItemToTest.WriteEntity( null ).Count == 1;

             Assert.IsTrue( wereCool );
        }
        public void Get_AddingItemWithNotSerializedProperty_RetrievedItemMissingProperty()
        {
            var dataItem = new SimpleItemWithDontSerializeAttribute
                        {
                           SerializedString = "foo",
                           NotSerializedString = "bar"
                        };

             _tableStorageProvider.Add( _tableName, dataItem, _partitionKey, _rowKey );
             _tableStorageProvider.Save();

             var gotItem = _tableStorageProvider.Get<SimpleItemWithDontSerializeAttribute>( _tableName, _partitionKey, _rowKey );

             Assert.AreEqual( null, gotItem.NotSerializedString );
             Assert.AreEqual( dataItem.SerializedString, gotItem.SerializedString );
        }
Beispiel #4
0
        public void SimpleItemWithDontSerializeAttributeConvertsToGenericEntityCorrectly()
        {
            var itemToSave = new SimpleItemWithDontSerializeAttribute
                          {
                             SerializedString = "foo",
                             NotSerializedString = "bar"
                          };

             var genericItemToTest = GenericEntity.HydrateFrom( itemToSave, "pk", "rk" );

             var wereCool = true;

             wereCool &= itemToSave.SerializedString == (string) genericItemToTest.GetProperties()["SerializedString"].Value;

             try
             {
            wereCool &= null == genericItemToTest.GetProperties()["NotSerializedString"].Value;
             }
             catch ( KeyNotFoundException )
             {
            wereCool &= true;
             }

             wereCool &= genericItemToTest.GetProperties().Count == 1;

             Assert.IsTrue( wereCool );
        }