Пример #1
0
            // GET Actual
            public object[] GetActual(SectionKeyValuePropertiesChangeTestTarget target)
            {
                // Prepare Line
                PrivateProfileLine line;

                switch (target)
                {
                case SectionKeyValuePropertiesChangeTestTarget.SectionName:

                    // New Line for SectionNamePropertyChangeTest
                    line = new PrivateProfileLine()
                    {
                        SectionName = this.BeforeChange
                    };

                    // ACT: Change value
                    line.SectionName = this.SectionName;

                    // RETURN
                    return(LineTestParameter.ConvertToObjectArray(line.LineType, line.RawLine, line.SectionName, null, null));

                case SectionKeyValuePropertiesChangeTestTarget.Key:

                    // New Line for KeyPropertyChangeTest
                    line = new PrivateProfileLine()
                    {
                        Key = this.BeforeChange, Value = this.Value
                    };

                    // ACT: Change KEY
                    line.Key = this.Key;

                    // RETURN
                    return(LineTestParameter.ConvertToObjectArray(line.LineType, line.RawLine, null, line.Key, line.Value));

                case SectionKeyValuePropertiesChangeTestTarget.Value:

                    // New Line for ValuePropertyChangeTest
                    line = new PrivateProfileLine()
                    {
                        Key = this.Key, Value = this.BeforeChange
                    };

                    // ACT: Change VALUE
                    line.Value = this.Value;

                    // RETURN
                    return(LineTestParameter.ConvertToObjectArray(line.LineType, line.RawLine, null, line.Key, line.Value));

                default:
                    throw new InternalTestFailureException();
                }
            }
Пример #2
0
            // ACT
            public override void Act(out object[] actual)
            {
                var line = new PrivateProfileLine(this.RawLine);

                actual = this.LineType switch
                {
                    PrivateProfileLineType.NotInitialized => throw new InvalidOperationException(),
                          PrivateProfileLineType.Section => LineTestParameter.ConvertToObjectArray(line.LineType, line.RawLine, line.SectionName, null, null),
                          PrivateProfileLineType.Entry => LineTestParameter.ConvertToObjectArray(line.LineType, line.RawLine, null, line.Key, line.Value),
                          PrivateProfileLineType.Other => LineTestParameter.ConvertToObjectArray(line.LineType, line.RawLine, null, null, null),
                          _ => throw new InvalidOperationException(),
                };
            }
Пример #3
0
            // ACT
            public override void Act(out object[] actual)
            {
                // Prepare PrivateProfileLine
                PrivateProfileLine line;

                switch (this.LineType)
                {
                case PrivateProfileLineType.NotInitialized:
                    throw new InvalidOperationException();

                case PrivateProfileLineType.Section:

                    // ACT
                    line = new PrivateProfileLine()
                    {
                        SectionName = this.SectionName
                    };

                    actual = LineTestParameter.ConvertToObjectArray(line.LineType, line.RawLine, line.SectionName, null, null);
                    break;

                case PrivateProfileLineType.Entry:

                    // ACT
                    line = new PrivateProfileLine()
                    {
                        Key = this.Key, Value = this.Value
                    };

                    actual = LineTestParameter.ConvertToObjectArray(line.LineType, line.RawLine, null, line.Key, line.Value);
                    break;

                case PrivateProfileLineType.Other:
                    throw new NotSupportedException();

                default:
                    throw new InvalidOperationException();
                }
            }
Пример #4
0
 // ARRANGE: SET Expected
 // { LineType, RawLine, Section, Key, Value }
 public override void Arrange(out object[] expected) =>
 expected = LineTestParameter.ConvertToObjectArray(this.LineType, this.RawLine, this.SectionName, this.Key, this.Value);