示例#1
0
        public Vacancy GetModel()
        {
            var vacancy = new Vacancy(
                Id,
                Name,
                Type.GetModel(),
                Description,
                KeySkills.Select(ks => ks.Name).ToList(),
                AddressJsonModel?.GetModel(),
                Schedule?.GetModel(),
                AcceptHandicapped,
                AcceptKids,
                Experience?.GetModel(),
                Employment?.GetModel(),
                SalaryJsonModel?.GetModel(),
                Archived,
                PublishedAt,
                Department?.GetModel(),
                ContactsJsonModel?.GetModel(),
                HasTest,
                TestRequired?.GetModel(),
                EmployerJsonModel.GetModel()
                );

            SpecializationsJsonModels.ForEach(s => vacancy.AddSpecialization(s.GetModel()));
            return(vacancy);
        }
示例#2
0
        public void BuildPartial()
        {
            // We're mostly testing that no exception is thrown.
            TestRequired message = TestRequired.CreateBuilder().BuildPartial();

            Assert.IsFalse(message.IsInitialized);
        }
示例#3
0
 public void ParseUnititialized()
 {
     try {
         TestRequired.ParseFrom(ByteString.Empty);
         Assert.Fail("Should have thrown an exception.");
     } catch (InvalidProtocolBufferException e) {
         Assert.AreEqual("Message missing required fields: a, b, c", e.Message);
     }
 }
示例#4
0
 public void UninitializedException()
 {
     try {
         TestRequired.CreateBuilder().Build();
         Assert.Fail("Should have thrown an exception.");
     } catch (UninitializedMessageException e) {
         Assert.AreEqual("Message missing required fields: a, b, c", e.Message);
     }
 }
示例#5
0
        public void Initialization()
        {
            TestRequired.Builder builder = TestRequired.CreateBuilder();

            Assert.IsFalse(builder.IsInitialized);
            builder.A = 1;
            Assert.IsFalse(builder.IsInitialized);
            builder.B = 1;
            Assert.IsFalse(builder.IsInitialized);
            builder.C = 1;
            Assert.IsTrue(builder.IsInitialized);
        }
示例#6
0
        public void RequiredFields()
        {
            var message = new TestRequired();

            Assert.False(message.IsInitialized());

            message.A = 1;
            message.B = 2;
            message.C = 3;

            Assert.True(message.IsInitialized());
        }
        public void IsInitialized()
        {
            TestRequired.Builder           builder         = TestRequired.CreateBuilder();
            AbstractMessageWrapper.Builder abstractBuilder = new AbstractMessageWrapper.Builder(builder);

            Assert.IsFalse(abstractBuilder.IsInitialized);
            builder.A = 1;
            Assert.IsFalse(abstractBuilder.IsInitialized);
            builder.B = 1;
            Assert.IsFalse(abstractBuilder.IsInitialized);
            builder.C = 1;
            Assert.IsTrue(abstractBuilder.IsInitialized);
        }
示例#8
0
        public void ParseUninitialized()
        {
            var e = Assert.Throws <InvalidProtocolBufferException>(() => TestRequired.ParseFrom(ByteString.Empty));

            Assert.AreEqual("Message missing required fields: a, b, c", e.Message);
        }
示例#9
0
        public void UninitializedException()
        {
            var e = Assert.Throws <UninitializedMessageException>(() => TestRequired.CreateBuilder().Build());

            Assert.AreEqual("Message missing required fields: a, b, c", e.Message);
        }
示例#10
0
 public void UninitializedBuilderToString()
 {
     TestRequired.Builder builder = TestRequired.CreateBuilder().SetA(1);
     Assert.AreEqual("a: 1\n", builder.ToString());
 }