public void SetImport_SetPostValueAndSetAgainOnInstance_ShouldSetProperty() { var import = new MySharedPartExport(); var part = CreatePart(import); var importDef = part.ImportDefinitions.First(); part.SetImport(importDef, CreateSimpleExports(21)); Assert.NotEqual(21, import.Value); part.Activate(); Assert.Equal(21, import.Value); part.SetImport(importDef, CreateSimpleExports(42)); Assert.NotEqual(42, import.Value); part.Activate(); Assert.Equal(42, import.Value); }
public void SetImport_SetPostValueAndSetAgainOnInstance_ShouldSetProperty() { var import = new MySharedPartExport(); var part = CreatePart(import); var importDef = part.ImportDefinitions.First(); part.SetImport(importDef, CreateSimpleExports(21)); Assert.AreNotEqual(import.Value, 21, "Value should NOT be set on live object until OnComposed"); part.Activate(); Assert.AreEqual(import.Value, 21, "Value should be set on live object now"); part.SetImport(importDef, CreateSimpleExports(42)); Assert.AreNotEqual(import.Value, 42, "Value should NOT be rebound on live object"); part.Activate(); Assert.AreEqual(import.Value, 42, "Value should be set on live object now"); }