42 строки
989 B
C#
42 строки
989 B
C#
|
using System;
|
|||
|
using Xunit;
|
|||
|
|
|||
|
namespace HotUI.Tests {
|
|||
|
public class HotReloadWithParameters : TestBase {
|
|||
|
public class MyOrgView : View {
|
|||
|
public const string TextValue = "Hello!";
|
|||
|
public MyOrgView (string text)
|
|||
|
{
|
|||
|
HotReloadHelper.Register (this, text);
|
|||
|
this.Body = () => new Text (text);
|
|||
|
}
|
|||
|
}
|
|||
|
public class MyNewView : View {
|
|||
|
public MyNewView (string text)
|
|||
|
{
|
|||
|
HotReloadHelper.Register (this, text);
|
|||
|
this.Body = () => new Text (text);
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
public HotReloadWithParameters ()
|
|||
|
{
|
|||
|
HotReloadHelper.IsEnabled = true;
|
|||
|
}
|
|||
|
|
|||
|
[Fact]
|
|||
|
public void HotReloadRegisterReplacedViewReplacesView ()
|
|||
|
{
|
|||
|
var orgView = new MyOrgView (MyOrgView.TextValue);
|
|||
|
var orgText = orgView.GetView () as Text;
|
|||
|
Assert.Equal (MyOrgView.TextValue, orgText.Value);
|
|||
|
|
|||
|
HotReloadHelper.RegisterReplacedView (typeof (MyOrgView).FullName, typeof (MyNewView));
|
|||
|
var newText = orgView.GetView () as Text;
|
|||
|
|
|||
|
Assert.Equal (MyOrgView.TextValue, newText.Value);
|
|||
|
|
|||
|
}
|
|||
|
}
|
|||
|
}
|