Beispiel #1
0
        public void LauncherRepo_Retrieve()
        {
            Repo.Create(AngaraA5);

            // We create a copy of the launcher so we have something to compare against the retrieved launcher.
            // Since the serialized launcher doesn't save everything, we have to change a value that IS saved.
            var editedLauncher = AngaraA5.CopyObject();

            editedLauncher.RootIdentifier = Guid.NewGuid();

            var retrievedObject = Repo.Retrieve(AngaraA5.Name);

            // We serialized the default launcher, so if we retrieved that, its "RootIdentifier" should be the same.
            // With that said, if we retrieved the default launcher, it shouldn't be equal the edited launcher.
            Assert.IsTrue(retrievedObject.RootIdentifier == AngaraA5.RootIdentifier);
            Assert.IsTrue(retrievedObject.RootIdentifier != editedLauncher.RootIdentifier);
        }
Beispiel #2
0
        public void LauncherRepo_Update()
        {
            Repo.Create(AngaraA5);

            // We create a copy of the launcher so we have something to compare against the retrieved launcher.
            // Since the serialized launcher doesn't save everything, we have to change a value that IS saved.
            var editedLauncher = AngaraA5.CopyObject();

            editedLauncher.RootIdentifier = Guid.NewGuid();

            // Update the newly create launcher with the edited launcher.
            Repo.Update(editedLauncher);

            // Retrieve the updated launcher.
            var retievedObject = Repo.Retrieve(AngaraA5.Name);

            // We update the launcher with another one that had an edit
            // "RootIdentifier", so it shouldn't be equal the default launcher.
            Assert.IsTrue(retievedObject.RootIdentifier != AngaraA5.RootIdentifier);
        }
Beispiel #3
0
        public void LauncherRepo_CreateAlreadyExistentItem()
        {
            Repo.Create(AngaraA5);

            // We create a copy of the launcher so we have something to compare against the retrieved launcher.
            // Since the serialized launcher doesn't save everything, we have to change a value that IS saved.
            var editedLauncher = AngaraA5.CopyObject();

            editedLauncher.RootIdentifier = Guid.NewGuid();

            // Try to create another object even though one should already exist.
            Repo.Create(editedLauncher);

            var retievedObject = Repo.Retrieve(AngaraA5.Name);

            // We tried to create a launcher with the same name, but an edited "RootIdentifier". Since
            // the Create() method doesn't allow the creation of launcher directories with the same name,
            // the retrieved object's "RootIdentifier" shouldn't equal the edited launcher's identifier.
            Assert.IsTrue(retievedObject.RootIdentifier != editedLauncher.RootIdentifier);
        }
        public void CatalogInitializer_AngaraA5Creation()
        {
            var launcher = new Launcher()
            {
                Name  = "Angara A5",
                Notes = new List <Note>()
                {
                    new Note()
                    {
                        Title = "Throttle Profile",
                        Body  = "Core throttles to 37% at 35 seconds after liftoff. Goes back to 100% right before booster separation."
                    }
                },
                PacificationOptions = new List <PacificationOption>()
                {
                    new PacificationOption()
                    {
                        PacificationType = PacificationType.Deorbit,
                        RequiredDeltaV   = 150
                    },
                    new PacificationOption()
                    {
                        PacificationType = PacificationType.GraveyardOrbit,
                        RequiredDeltaV   = 350
                    }
                },
                Price             = 221000,
                PreviewLocation   = @"C:/Nick/TestFolder/CollectionPictures/NothingHere.png",
                CraftFileLocation = @"C:/Nick/TestFolder/CraftFile/NothingHere.craft",
                Tags = new List <string>()
                {
                    "Angara",
                    "A5"
                },
                Fairings = new List <Fairing>()
                {
                    new Fairing()
                    {
                        ID       = "Small",
                        Length   = 10,
                        Diameter = 2.8
                    },
                    new Fairing()
                    {
                        ID       = "Medium",
                        Length   = 12,
                        Diameter = 3
                    },
                    new Fairing()
                    {
                        ID       = "Large",
                        Length   = 14,
                        Diameter = 3
                    }
                },
                Capabilities = new List <Capability>()
                {
                    new Capability()
                    {
                        PayloadRange = new PayloadRange()
                        {
                            Lightest = 20500,
                            Heaviest = 24500
                        },
                        Trajectory = new Trajectory()
                        {
                            OrbitType      = OrbitType.LEO,
                            Apoapsis       = 250,
                            Periapsis      = 250,
                            Inclination    = 28.7,
                            RequiredDeltaV = 6100
                        }
                    },
                    new Capability()
                    {
                        PayloadRange = new PayloadRange()
                        {
                            Lightest = 4000,
                            Heaviest = 8000
                        },
                        Trajectory = new Trajectory()
                        {
                            OrbitType      = OrbitType.GTO,
                            Apoapsis       = 11475,
                            Periapsis      = 350,
                            Inclination    = 2.0,
                            RequiredDeltaV = 7650
                        }
                    },
                    new Capability()
                    {
                        PayloadRange = new PayloadRange()
                        {
                            Lightest = 0,
                            Heaviest = 4000
                        },
                        Trajectory = new Trajectory()
                        {
                            OrbitType      = OrbitType.GEO,
                            Apoapsis       = 11475,
                            Periapsis      = 11475,
                            Inclination    = 0.0,
                            RequiredDeltaV = 9100
                        }
                    }
                },
                MaxPayloadDimensions = new PayloadDimensions(8, 2.75)
            };

            Assert.IsTrue(AngaraA5.CompareObject(launcher));
        }