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); }
public void BuildPartial() { // We're mostly testing that no exception is thrown. TestRequired message = TestRequired.CreateBuilder().BuildPartial(); Assert.IsFalse(message.IsInitialized); }
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); } }
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); } }
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); }
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); }
public void ParseUninitialized() { var e = Assert.Throws <InvalidProtocolBufferException>(() => TestRequired.ParseFrom(ByteString.Empty)); Assert.AreEqual("Message missing required fields: a, b, c", e.Message); }
public void UninitializedException() { var e = Assert.Throws <UninitializedMessageException>(() => TestRequired.CreateBuilder().Build()); Assert.AreEqual("Message missing required fields: a, b, c", e.Message); }
public void UninitializedBuilderToString() { TestRequired.Builder builder = TestRequired.CreateBuilder().SetA(1); Assert.AreEqual("a: 1\n", builder.ToString()); }