Example #1
0
 public void UpdateValuesThrowsContractException387()
 {
     try
     {
         VoterDO voterDO;
         voterDO = PexInvariant.CreateInstance <VoterDO>();
         PexInvariant.SetField <uint?>((object)voterDO, "primaryKey", default(uint?));
         PexInvariant.SetField <EntityRef <PollingStationDO> >
             ((object)voterDO, "_pollingStation", default(EntityRef <PollingStationDO>));
         PexInvariant.SetField <uint?>
             ((object)voterDO, "<PollingStationId>k__BackingField", default(uint?));
         PexInvariant.SetField <string>
             ((object)voterDO, "<Name>k__BackingField", (string)null);
         PexInvariant.SetField <string>
             ((object)voterDO, "<Address>k__BackingField", (string)null);
         PexInvariant.SetField <string>
             ((object)voterDO, "<City>k__BackingField", (string)null);
         PexInvariant.SetField <bool?>
             ((object)voterDO, "<CardPrinted>k__BackingField", new bool?(true));
         PexInvariant.SetField <bool?>
             ((object)voterDO, "<Voted>k__BackingField", new bool?(true));
         PexInvariant.CheckInvariant((object)voterDO);
         this.UpdateValues(voterDO, (IDataObject)null);
         throw
             new AssertFailedException("expected an exception of type ContractException");
     }
     catch (Exception ex)
     {
         if (!PexContract.IsContractException(ex))
         {
             throw ex;
         }
     }
 }
Example #2
0
        public void Equals01356()
        {
            VoterDO voterDO;
            bool    b;

            voterDO = PexInvariant.CreateInstance <VoterDO>();
            PexInvariant.SetField <uint?>((object)voterDO, "primaryKey", default(uint?));
            PexInvariant.SetField <EntityRef <PollingStationDO> >
                ((object)voterDO, "_pollingStation", default(EntityRef <PollingStationDO>));
            PexInvariant.SetField <uint?>
                ((object)voterDO, "<PollingStationId>k__BackingField", default(uint?));
            PexInvariant.SetField <string>
                ((object)voterDO, "<Name>k__BackingField", (string)null);
            PexInvariant.SetField <string>
                ((object)voterDO, "<Address>k__BackingField", (string)null);
            PexInvariant.SetField <string>
                ((object)voterDO, "<City>k__BackingField", (string)null);
            PexInvariant.SetField <bool?>
                ((object)voterDO, "<CardPrinted>k__BackingField", new bool?(true));
            PexInvariant.SetField <bool?>
                ((object)voterDO, "<Voted>k__BackingField", new bool?(true));
            PexInvariant.CheckInvariant((object)voterDO);
            b = this.Equals01(voterDO, (object)null);
            Assert.AreEqual <bool>(false, b);
            Assert.IsNotNull((object)voterDO);
            Assert.IsNull((object)(voterDO.PrimaryKey));
            Assert.IsNull((object)(voterDO.PollingStationId));
            Assert.AreEqual <string>((string)null, voterDO.Name);
            Assert.AreEqual <string>((string)null, voterDO.Address);
            Assert.AreEqual <string>((string)null, voterDO.City);
            Assert.IsNotNull((object)(voterDO.CardPrinted));
            Assert.AreEqual <bool>(true, (bool)((object)(voterDO.CardPrinted)));
            Assert.IsNotNull((object)(voterDO.Voted));
            Assert.AreEqual <bool>(true, (bool)((object)(voterDO.Voted)));
        }
Example #3
0
        public void GetHashCode01277()
        {
            VoterDO voterDO;
            int     i;

            voterDO = PexInvariant.CreateInstance <VoterDO>();
            PexInvariant.SetField <uint?>((object)voterDO, "primaryKey", default(uint?));
            PexInvariant.SetField <EntityRef <PollingStationDO> >
                ((object)voterDO, "_pollingStation", default(EntityRef <PollingStationDO>));
            PexInvariant.SetField <uint?>
                ((object)voterDO, "<PollingStationId>k__BackingField", default(uint?));
            PexInvariant.SetField <string>((object)voterDO, "<Name>k__BackingField", "");
            PexInvariant.SetField <string>
                ((object)voterDO, "<Address>k__BackingField", (string)null);
            PexInvariant.SetField <string>
                ((object)voterDO, "<City>k__BackingField", (string)null);
            PexInvariant.SetField <bool?>
                ((object)voterDO, "<CardPrinted>k__BackingField", new bool?(true));
            PexInvariant.SetField <bool?>
                ((object)voterDO, "<Voted>k__BackingField", new bool?(true));
            PexInvariant.CheckInvariant((object)voterDO);
            i = this.GetHashCode01(voterDO);
            Assert.AreEqual <int>(757602046, i);
            Assert.IsNotNull((object)voterDO);
            Assert.IsNull((object)(voterDO.PrimaryKey));
            Assert.IsNull((object)(voterDO.PollingStationId));
            Assert.AreEqual <string>("", voterDO.Name);
            Assert.AreEqual <string>((string)null, voterDO.Address);
            Assert.AreEqual <string>((string)null, voterDO.City);
            Assert.IsNotNull((object)(voterDO.CardPrinted));
            Assert.AreEqual <bool>(true, (bool)((object)(voterDO.CardPrinted)));
            Assert.IsNotNull((object)(voterDO.Voted));
            Assert.AreEqual <bool>(true, (bool)((object)(voterDO.Voted)));
        }
Example #4
0
        public void ChunkSizeGet01()
        {
            Chunker chunker;

            chunker = PexInvariant.CreateInstance <Chunker>();
            PexInvariant.SetField <string>((object)chunker, "stringData", "");
            PexInvariant.SetField <int>((object)chunker, "chunkSize", 1);
            PexInvariant.SetField <int>((object)chunker, "returnedCount", 0);
            PexInvariant.CheckInvariant((object)chunker);
            this.ChunkSizeGet(chunker);
        }
Example #5
0
        public void UpdateValues889()
        {
            VoterDO voterDO;
            VoterDO voterDO1;

            voterDO = PexInvariant.CreateInstance <VoterDO>();
            PexInvariant.SetField <uint?>((object)voterDO, "primaryKey", default(uint?));
            PexInvariant.SetField <EntityRef <PollingStationDO> >
                ((object)voterDO, "_pollingStation", default(EntityRef <PollingStationDO>));
            PexInvariant.SetField <uint?>
                ((object)voterDO, "<PollingStationId>k__BackingField", default(uint?));
            PexInvariant.SetField <string>
                ((object)voterDO, "<Name>k__BackingField", (string)null);
            PexInvariant.SetField <string>
                ((object)voterDO, "<Address>k__BackingField", (string)null);
            PexInvariant.SetField <string>
                ((object)voterDO, "<City>k__BackingField", (string)null);
            PexInvariant.SetField <bool?>
                ((object)voterDO, "<CardPrinted>k__BackingField", new bool?(true));
            PexInvariant.SetField <bool?>
                ((object)voterDO, "<Voted>k__BackingField", new bool?(true));
            PexInvariant.CheckInvariant((object)voterDO);
            voterDO1 = PexInvariant.CreateInstance <VoterDO>();
            PexInvariant.SetField <uint?>
                ((object)voterDO1, "primaryKey", new uint?(268780865u));
            PexInvariant.SetField <EntityRef <PollingStationDO> >
                ((object)voterDO1, "_pollingStation", default(EntityRef <PollingStationDO>));
            PexInvariant.SetField <uint?>
                ((object)voterDO1, "<PollingStationId>k__BackingField", default(uint?));
            PexInvariant.SetField <string>
                ((object)voterDO1, "<Name>k__BackingField", (string)null);
            PexInvariant.SetField <string>
                ((object)voterDO1, "<Address>k__BackingField", (string)null);
            PexInvariant.SetField <string>
                ((object)voterDO1, "<City>k__BackingField", (string)null);
            PexInvariant.SetField <bool?>
                ((object)voterDO1, "<CardPrinted>k__BackingField", new bool?(true));
            PexInvariant.SetField <bool?>
                ((object)voterDO1, "<Voted>k__BackingField", new bool?(true));
            PexInvariant.CheckInvariant((object)voterDO1);
            this.UpdateValues(voterDO, (IDataObject)voterDO1);
            Assert.IsNotNull((object)voterDO);
            Assert.IsNotNull((object)(voterDO.PrimaryKey));
            Assert.AreEqual <uint>(268780865u, (uint)((object)(voterDO.PrimaryKey)));
            Assert.IsNull((object)(voterDO.PollingStationId));
            Assert.AreEqual <string>((string)null, voterDO.Name);
            Assert.AreEqual <string>((string)null, voterDO.Address);
            Assert.AreEqual <string>((string)null, voterDO.City);
            Assert.IsNotNull((object)(voterDO.CardPrinted));
            Assert.AreEqual <bool>(true, (bool)((object)(voterDO.CardPrinted)));
            Assert.IsNotNull((object)(voterDO.Voted));
            Assert.AreEqual <bool>(true, (bool)((object)(voterDO.Voted)));
        }
Example #6
0
        public void NextChunk02()
        {
            Chunker chunker;
            string  s;

            chunker = PexInvariant.CreateInstance <Chunker>();
            PexInvariant.SetField <string>((object)chunker, "stringData", "\0");
            PexInvariant.SetField <int>((object)chunker, "chunkSize", 1);
            PexInvariant.SetField <int>((object)chunker, "returnedCount", 0);
            PexInvariant.CheckInvariant((object)chunker);
            s = this.NextChunk(chunker);
            Assert.AreEqual <string>("\0", s);
        }
Example #7
0
        public static global::NatSet.NatSet Create(bool[] sm_bs, List <int> rest_list, int max_i)
        {
            global::NatSet.NatSet natSet
                = PexInvariant.CreateInstance <global::NatSet.NatSet>();
            PexInvariant.SetField <bool[]>((object)natSet, "sm", sm_bs);
            PexInvariant.SetField <List <int> >((object)natSet, "rest", rest_list);
            PexInvariant.SetField <int>((object)natSet, "max", max_i);
            PexInvariant.CheckInvariant((object)natSet);
            return(natSet);

            // TODO: Edit factory method of NatSet
            // This method should be able to configure the object in all possible ways.
            // Add as many parameters as needed,
            // and assign their values to each field by using the API.
        }
Example #8
0
 public void UnregisterCurrentVoterThrowsContractException834()
 {
     try
     {
         VoterDO voterDO;
         Model   model;
         voterDO = PexInvariant.CreateInstance <VoterDO>();
         PexInvariant.SetField <uint?>((object)voterDO, "primaryKey", default(uint?));
         PexInvariant.SetField <EntityRef <PollingStationDO> >
             ((object)voterDO, "_pollingStation", default(EntityRef <PollingStationDO>));
         PexInvariant.SetField <uint?>
             ((object)voterDO, "<PollingStationId>k__BackingField", default(uint?));
         PexInvariant.SetField <string>
             ((object)voterDO, "<Name>k__BackingField", (string)null);
         PexInvariant.SetField <string>
             ((object)voterDO, "<Address>k__BackingField", (string)null);
         PexInvariant.SetField <string>
             ((object)voterDO, "<City>k__BackingField", (string)null);
         PexInvariant.SetField <bool?>
             ((object)voterDO, "<CardPrinted>k__BackingField", new bool?(true));
         PexInvariant.SetField <bool?>
             ((object)voterDO, "<Voted>k__BackingField", new bool?(false));
         PexInvariant.CheckInvariant((object)voterDO);
         model = new Model();
         model.currentVoter = voterDO;
         model.AdminPass    = (string)null;
         this.UnregisterCurrentVoter(model);
         throw
             new AssertFailedException("expected an exception of type ContractException");
     }
     catch (Exception ex)
     {
         if (!PexContract.IsContractException(ex))
         {
             throw ex;
         }
     }
 }
Example #9
0
        public void FullyInitialized611()
        {
            VoterDO voterDO;
            bool    b;

            voterDO = PexInvariant.CreateInstance <VoterDO>();
            PexInvariant.SetField <uint?>((object)voterDO, "primaryKey", default(uint?));
            PexInvariant.SetField <EntityRef <PollingStationDO> >
                ((object)voterDO, "_pollingStation", default(EntityRef <PollingStationDO>));
            PexInvariant.SetField <uint?>
                ((object)voterDO, "<PollingStationId>k__BackingField", new uint?(1u));
            PexInvariant.SetField <string>
                ((object)voterDO, "<Name>k__BackingField", (string)null);
            PexInvariant.SetField <string>
                ((object)voterDO, "<Address>k__BackingField", (string)null);
            PexInvariant.SetField <string>
                ((object)voterDO, "<City>k__BackingField", (string)null);
            PexInvariant.SetField <bool?>((object)voterDO, "<CardPrinted>k__BackingField",
                                          new bool?(PexSafeHelpers.ByteToBoolean((byte)2)));
            PexInvariant.SetField <bool?>
                ((object)voterDO, "<Voted>k__BackingField", new bool?(true));
            PexInvariant.CheckInvariant((object)voterDO);
            b = this.FullyInitialized(voterDO);
            Assert.AreEqual <bool>(false, b);
            Assert.IsNotNull((object)voterDO);
            Assert.IsNull((object)(voterDO.PrimaryKey));
            Assert.IsNotNull((object)(voterDO.PollingStationId));
            Assert.AreEqual <uint>(1u, (uint)((object)(voterDO.PollingStationId)));
            Assert.AreEqual <string>((string)null, voterDO.Name);
            Assert.AreEqual <string>((string)null, voterDO.Address);
            Assert.AreEqual <string>((string)null, voterDO.City);
            Assert.IsNotNull((object)(voterDO.CardPrinted));
            Assert.AreEqual <bool>(PexSafeHelpers.ByteToBoolean((byte)2),
                                   (bool)((object)(voterDO.CardPrinted)));
            Assert.IsNotNull((object)(voterDO.Voted));
            Assert.AreEqual <bool>(true, (bool)((object)(voterDO.Voted)));
        }