public void SetsActorRef() { Actor a = new Actor(); MyBehavior b = new MyBehavior(); a.Add(b); Assert.AreSame(a, b.Actor); }
public void When_Attached_Property_No_DP() { var control = new Test_Control(); var noDP = MyBehavior.GetNoDPProperty(control.TestTextBlock); Assert.AreEqual(256, noDP); }
public void When_Attached_Property_And_Top_Level() { var page = new Test_Page(); var bulbousness = MyBehavior.GetBulbousness(page); Assert.AreEqual(256, bulbousness); }
public void When_Attached_Property_And_Local_Resource() { var control = new Test_Control(); var bulbousness = MyBehavior.GetBulbousness(control.TestBorder); Assert.AreEqual(105.5, bulbousness); }
public void When_Attached_Property_And_App_Resource() { var control = new Test_Control(); var bulbousness = MyBehavior.GetBulbousness(control.TestTextBlock); Assert.AreEqual(256, bulbousness); }
public void BehaviorConstructor2() { tlog.Debug(tag, $"BehaviorConstructor2 START"); MyBehavior <View> mb = new MyBehavior <View>(); Assert.IsNotNull(mb, "Should not be null"); tlog.Debug(tag, $"BehaviorConstructor2 END"); }
public void AttachTo2() { tlog.Debug(tag, $"AttachTo2 START"); var mb = new MyBehavior(typeof(View)); var v = new View(); mb.TestAttachTo(v); mb.TestDetachFrom(v); tlog.Debug(tag, $"AttachTo2 END"); }
public void AttachTo() { tlog.Debug(tag, $"AttachTo START"); var mb = new MyBehavior(typeof(int)); Assert.Throws <ArgumentNullException>(() => mb.TestAttachTo(null)); var v = new View(); Assert.Throws <InvalidOperationException>(() => mb.TestAttachTo(v)); tlog.Debug(tag, $"AttachTo END"); }
public void AssociatedTypeTest() { tlog.Debug(tag, $"AssociatedTypeTest START"); MyBehavior <View> mb = new MyBehavior <View>(); Assert.IsNotNull(mb, "Should not be null"); var ret = mb.GetAssociatedType(); Assert.IsNotNull(ret, "Should not be null"); tlog.Debug(tag, $"AssociatedTypeTest END"); }
public void OnDetachingFromTest() { tlog.Debug(tag, $"OnDetachingFromTest START"); try { MyBehavior <View> mb = new MyBehavior <View>(); Assert.IsNotNull(mb, "Should not be null"); mb.DetachingFrom(new View()); } catch (Exception e) { Assert.Fail("Should not thow exception: " + e.Message); } tlog.Debug(tag, $"OnDetachingFromTest END"); }
public void OnAttachedToTest() { tlog.Debug(tag, $"AssociatedTypeTest START"); try { MyBehavior <View> mb = new MyBehavior <View>(); Assert.IsNotNull(mb, "Should not be null"); mb.AttachedTo(new View()); } catch (Exception e) { Assert.Fail("Should not thow exception: " + e.Message); } tlog.Debug(tag, $"AssociatedTypeTest END"); }
private static void Main() { Console.Write("Your Service Namespace Domain (ex. https://<DOMAIN>.servicebus.windows.net/): "); string serviceNamespaceDomain = Console.ReadLine(); // By setting EndToEndWebHttpSecurityMode.Transport we use HTTPS. // If you want to use HTTP please set EndToEndWebHttpSecurityMode.None. // In this sample we need to authenticate client via Access Control Service so // RelayClientAuthenticationType.RelayAccessToken is set. You can set RelayClientAuthenticationType.None // If you don't want to authenticate client via Access Control Service. WebHttpRelayBinding binding = new WebHttpRelayBinding(EndToEndWebHttpSecurityMode.Transport, RelayClientAuthenticationType.RelayAccessToken); // Replace above code with the following one to test in browser // WebHttpRelayBinding binding = new WebHttpRelayBinding(EndToEndWebHttpSecurityMode.Transport, RelayClientAuthenticationType.None); // Initialize ServiceHost using custom binding Uri address = ServiceBusEnvironment.CreateServiceUri("https", serviceNamespaceDomain, "DataService"); WebServiceHost host = new WebServiceHost(typeof(NorthwindDataService), address); host.AddServiceEndpoint("System.Data.Services.IRequestHandler", binding, address); var eb = new TransportClientEndpointBehavior() { CredentialType = TransportClientCredentialType.SharedSecret }; eb.Credentials.SharedSecret.IssuerName = "owner"; eb.Credentials.SharedSecret.IssuerSecret = "[Your Secret]"; host.Description.Endpoints[0].Behaviors.Add(eb); // The following behavior is used to work around exception caused by PUT/POST // requests when exposing via Service Bus MyBehavior mb = new MyBehavior(); host.Description.Endpoints[0].Behaviors.Add(mb); // Start service host.Open(); Console.WriteLine("Test the following URI in browser: "); Console.WriteLine(address + "Customers"); Console.WriteLine("Use the following URI if you want to generate client proxy for this service"); Console.WriteLine(address); Console.WriteLine(); Console.WriteLine("Press [Enter] to exit"); Console.ReadLine(); host.Close(); }
/*Inicjalizacja service zawartej w innym projekcie * - KONIECZNE JEST dodanie do referncji .dll z definicją serwisu * Standarowe wywołanie servicehost z typem * Dodanie customowego Behavior w runtime, który spowoduje przekazanie funcji do eventu. * W ten sposób InstanceContextMode może mieć dowolną wartość, bo behavior wypełni event na obiekcie service */ internal void InitService21() { ServiceHost host; try { host = new ServiceHost(typeof(MyService21)); /*Przekazanie precedury eventu przez behavior dodany w runtime*/ MyBehavior behavior = new MyBehavior(); behavior.Info = Info11; host.Description.Behaviors.Add(behavior); host.Open(); Info("Service21 online."); } catch (Exception ex) { host = null; Info(string.Format("There is an issue with MyService21: '" + ex.Message + "'")); } }
public void OnCall(MyBehavior tb) { Count++; }