public void SetPropertyValue_TestDateTimeOffset_Success() { //Arrange var expectedValue = new DateTimeOffset(2018, 7, 20, 7, 0, 0, TimeSpan.Zero); var complex = new ComplexElement(_fixture.TestPrimitive); //Act var firstKid = complex.GetChildren().First(x => x.RawName == "DateOffset"); ((ValueElementDateTime)firstKid).Data = expectedValue.DateTime; //Assert Assert.Equal(expectedValue, _fixture.TestPrimitive.DateOffset); }
public void SetPropertyValue_TestPrimitiveFirstProperty_Success() { //Arrange var expectedValue = "Grape"; var complex = new ComplexElement(_fixture.TestPrimitive); //Act var firstKid = complex.GetChildren().First(); ((ValueElementT <string>)firstKid).Data = expectedValue; //Assert Assert.Equal(expectedValue, _fixture.TestPrimitive.Name); }
public void GenerateObject_TestAttribute_ChildrenCountEqual() { //Arrange var complex = new ComplexElement(_fixture.TestAttribute); var expectedCount = complex.GetChildren().Count() - 1; //-1 because one element is ignored var __builder = new RenderTreeBuilder(); //Act var renderer = _fixture.RenderableContent.RenderComponent(complex); renderer.Invoke(__builder); var frames = __builder.GetFrames(); var vortexAttributeCount = frames.Array.AsEnumerable().Where(x => x.AttributeName == _attributeNameChild).Count(); //Assert Assert.Equal(vortexAttributeCount, expectedCount); }
public void Feature_OrderIncorrectIndex_IncorrectOrderExceptionThrow() { //Arrange var order = new Dictionary <string, int> { { "Name", 50 } }; var complex = new ComplexElement(_fixture.TestPrimitive, null, null, order, null); //Act //Assert Assert.Throws <IncorrectOrderException>(() => complex.GetChildren()); }
public void Feature_OrderChanged_Success() { //Arrange var order = new Dictionary <string, int> { { "Name", 3 }, { "FloatNumber", 0 } }; var complex = new ComplexElement(_fixture.TestPrimitive, null, null, order, null); //Act var children = complex.GetChildren(); //Assert Assert.Equal("FloatNumber", children.First().RawName); Assert.Equal("Name", children.ElementAt(3).RawName); }
public void Feature_AttributeCustomName_Picture_RenderIgnore_Date_RadioButtons_Success() { //Arrange var complex = new ComplexElement(_fixture.TestAttribute); //Act var children = complex.GetChildren(); var childName = children.First(x => x.RawName == "Name"); var childPicture = (ValueElementT <string>)children.First(x => x.RawName == "PictureUri"); var childIgnore = children.First(x => x.RawName == "IsFestival"); var childDate = (ValueElementDateTime)children.First(x => x.RawName == "Date"); var childEnum = (ValueElementEnumT <EnumType>)children.First(x => x.RawName == "MyEnum"); //Assert Assert.NotNull(childName.AttributeName); Assert.Equal("Nazov", childName.AttributeName); Assert.True(childPicture.IsPicture); Assert.True(childIgnore.IsIgnored); Assert.Equal(DateTypes.Date, childDate.DateType); Assert.True(childEnum.IsRadio); }
public void Feature_SetCustomName_Success() { //Arrange var label = new Dictionary <string, string> { { "Name", "meno" }, { "Date", "Datum" } }; var complex = new ComplexElement(_fixture.TestPrimitive, null, null, null, label); //Act var children = complex.GetChildren(); var childName = children.First(x => x.RawName == "Name"); var childDate = children.First(x => x.RawName == "Date"); //Assert Assert.Equal("meno", childName.AttributeName); Assert.Equal("Datum", childDate.AttributeName); }