public void PropertyHasBeenReplaced() { // Arrange TableClient table = Mock.Of <TableClient>(); PocoEntityWriter <SimpleClass> writer = new PocoEntityWriter <SimpleClass>(table); writer.TableEntityWriter = new StubTableEntityWriter(); Type valueType = typeof(PocoEntityWriter <SimpleClass>); PocoEntityCollectorBinder <SimpleClass> product = new PocoEntityCollectorBinder <SimpleClass>(table, writer, valueType); SimpleClass value = new SimpleClass { PartitionKey = "PK", RowKey = "RK" }; writer.Add(value); // Act var parameterLog = product.GetStatus() as TableParameterLog; // Assert Assert.AreEqual(1, parameterLog.EntitiesWritten); // Calling again should yield no changes parameterLog = product.GetStatus() as TableParameterLog; // Assert Assert.AreEqual(1, parameterLog.EntitiesWritten); // Add same value again. writer.Add(value); // Act parameterLog = product.GetStatus() as TableParameterLog; // Assert Assert.AreEqual(2, parameterLog.EntitiesWritten); }
public void PropertyHasBeenAdded() { // Arrange IStorageTableClient client = new StorageAccount(CloudStorageAccount.DevelopmentStorageAccount).CreateTableClient(); IStorageTable table = client.GetTableReference("table"); PocoEntityWriter <SimpleClass> writer = new PocoEntityWriter <SimpleClass>(table); writer.TableEntityWriter = new StubTableEntityWriter(); Type valueType = typeof(PocoEntityWriter <SimpleClass>); PocoEntityCollectorBinder <SimpleClass> product = new PocoEntityCollectorBinder <SimpleClass>(table, writer, valueType); SimpleClass value = new SimpleClass { PartitionKey = "PK", RowKey = "RK" }; writer.Add(value); // Act var parameterLog = product.GetStatus() as TableParameterLog; // Assert Assert.Equal(1, parameterLog.EntitiesWritten); }