public void CreateAndInitializeMemberFieldTest() { Type type = null; // TODO: Initialize to an appropriate value string memberField = string.Empty; // TODO: Initialize to an appropriate value CodeAssignStatement expected = null; // TODO: Initialize to an appropriate value CodeAssignStatement actual; actual = CodeMethodComposer.CreateAndInitializeMemberField(type, memberField); Assert.AreEqual(expected, actual); Assert.Inconclusive("Verify the correctness of this test method."); }
public void CreateAndInitializeMemberFieldTest() { var type = typeof(string); var memberfield = "theMember"; var actual = CodeMethodComposer.CreateAndInitializeMemberField(type, memberfield); Assert.IsInstanceOfType <CodeAssignStatement>(actual); object expectedValue = true; Type expectedType = expectedValue.GetType(); actual = CodeMethodComposer.CreateAndInitializeMemberField(expectedType, memberfield); var assignment = (CodePrimitiveExpression)actual.Right; Assert.AreEqual(true, assignment.Value); Assert.AreEqual(expectedType, assignment.Value.GetType()); expectedValue = typeof(CodeMethodComposerTest); expectedType = expectedValue.GetType(); actual = CodeMethodComposer.CreateAndInitializeMemberField(expectedType, memberfield); var assignment2 = (CodeObjectCreateExpression)actual.Right; Assert.AreEqual(expectedType.FullName, assignment2.CreateType.BaseType); expectedValue = 35; expectedType = expectedValue.GetType(); actual = CodeMethodComposer.CreateAndInitializeMemberField(expectedType, memberfield); assignment = (CodePrimitiveExpression)actual.Right; Assert.AreEqual(1234, assignment.Value); Assert.AreEqual(expectedType, assignment.Value.GetType()); expectedValue = new InfoApe(); expectedType = expectedValue.GetType(); actual = CodeMethodComposer.CreateAndInitializeMemberField(expectedType, memberfield); assignment2 = (CodeObjectCreateExpression)actual.Right; Assert.AreEqual(expectedType.FullName, assignment2.CreateType.BaseType); // Todo: implement all CLR-Types. }