public void TestMethod1() { RigTemplate rigTemplate = new RigTemplate(); for (int i = 0; i < 5; i++) { rigTemplate.EquipmentTemplates.Add(CreateEquipmentTemplate()); } EmmockJsonSerializer serializer = new EmmockJsonSerializer(); string json = serializer.SerializeObject(rigTemplate); Console.WriteLine(json); RigTemplate deserialzied = serializer.DeserializeObject <RigTemplate>(json); Assert.IsNotNull(deserialzied); }
public void GenerateJackupRig_RigAndEquipment_Created_Correctly() { // arrange IFileSystem fIleSystem = new FileSystem(); ISerializer serializer = new EmmockJsonSerializer(); IRigRepository rigRepo = new FileRigStore(fIleSystem, serializer); IEquipmentRepository equipmentRepo = new FileEquipmentStore(fIleSystem, serializer); IRigTemplateRepository rigTemplateRepo = new FileRigTemplateStore(fIleSystem, serializer); RigTemplate rigTemplate = rigTemplateRepo.GetRigTemplate("Jackup"); // act RigGenerator rigGenerator = new RigGenerator(rigRepo, equipmentRepo, rigTemplateRepo); Rig generatedRig = rigGenerator.GenerateRig("Jackup", "Rig For Test", ""); Rig actualRig = rigRepo.GetAll().FirstOrDefault(r => r.Id == generatedRig.Id); // assert Assert.IsNotNull(actualRig); Assert.AreEqual(generatedRig.Name, actualRig.Name); // TODO: Much deeper check around equipment created from generator }