Exemplo n.º 1
0
        public void CustomFieldsArePersistedWhenCopyingToANewState()
        {
            var state1 = new DatabaseJobState
            {
                Name  = "Test1",
                State = DatabaseJobState.JobState.Discovering
            };

            var fieldName  = "capella";
            var fieldValue = "first";

            state1.SetValue(fieldName, fieldValue);

            var setField = state1.GetValue(fieldName);

            setField.Should().Be(fieldValue);

            var fields = state1.Fields;

            fields.Should().Contain(x => x.Name == fieldName && x.Value == fieldValue);

            var state2 = new DatabaseJobState(state1);

            state2.Fields.Should().AllBeEquivalentTo(state1.Fields);
        }
Exemplo n.º 2
0
        public void CanSetFieldsThatAreNotAProperty()
        {
            var state = new DatabaseJobState
            {
                Name  = "Test1",
                State = DatabaseJobState.JobState.Discovering
            };

            var fieldName  = "capella";
            var fieldValue = "first";

            state.SetValue(fieldName, fieldValue);

            var setField = state.GetValue(fieldName);

            setField.Should().Be(fieldValue);

            var fields = state.Fields;

            fields.Should().Contain(x => x.Name == fieldName && x.Value == fieldValue);
        }