예제 #1
0
        public void XmlBuilder_CreateSlotSummary_PopulatesStringPropertiesThatAreNotNull()
        {
            // Arrange
            var client = new NullClient {
                Settings = new ClientSettings()
            };
            var slots      = new[] { new SlotModel(client) };
            var xmlBuilder = new XmlBuilder(client.Preferences);
            // Act
            var slotSummary = xmlBuilder.CreateSlotSummary(slots, DateTime.Now);

            // Assert
            Assert.IsNotNull(slotSummary.HfmVersion);
            Assert.IsNotNull(slotSummary.NumberFormat);
            Assert.AreEqual(1, slotSummary.Slots.Count);
            var slotData = slotSummary.Slots[0];

            Assert.IsNotNull(slotData.Core);
            Assert.IsNotNull(slotData.CoreId);
            var protein = slotData.Protein;

            Assert.IsNotNull(protein.ServerIP);
            Assert.IsNotNull(protein.WorkUnitName);
            Assert.IsNotNull(protein.Core);
            Assert.IsNotNull(protein.Description);
            Assert.IsNotNull(protein.Contact);
        }
예제 #2
0
        public void XmlBuilder_CreateSlotDetail_PopulatesStringPropertiesThatAreNotNull()
        {
            // Arrange
            var client = new NullClient {
                Settings = new ClientSettings()
            };
            var slot       = new SlotModel(client);
            var xmlBuilder = new XmlBuilder(client.Preferences);
            // Act
            var slotDetail = xmlBuilder.CreateSlotDetail(slot, DateTime.Now);

            // Assert
            Assert.IsNotNull(slotDetail.HfmVersion);
            Assert.IsNotNull(slotDetail.NumberFormat);
            Assert.IsNotNull(slotDetail.LogFileName);
            var slotData = slotDetail.SlotData;

            Assert.IsNotNull(slotData.Core);
            Assert.IsNotNull(slotData.CoreId);
            var protein = slotData.Protein;

            Assert.IsNotNull(protein.ServerIP);
            Assert.IsNotNull(protein.WorkUnitName);
            Assert.IsNotNull(protein.Core);
            Assert.IsNotNull(protein.Description);
            Assert.IsNotNull(protein.Contact);
        }
예제 #3
0
        private static ICollection <SlotModel> CreateSlotModelCollection()
        {
            var slots = new List <SlotModel>();

            // setup slot
            var client = new NullClient {
                Settings = new ClientSettings {
                    Name = "Test2"
                }
            };
            var slot     = new SlotModel(client);
            var logLines = new List <Log.LogLine>
            {
                new Log.LogLine {
                    LineType = LogLineType.LogOpen, Index = 1, Raw = "Open"
                }
            };

            slot.CurrentLogLines = logLines;
            slot.WorkUnitModel.WorkUnit.LogLines = logLines;
            slots.Add(slot);

            // setup slot
            client = new NullClient {
                Settings = new ClientSettings {
                    Name = "Test1"
                }
            };
            slot = new SlotModel(client);
            slots.Add(slot);

            return(slots);
        }
예제 #4
0
        static void Main(string[] args)
        {
            IClient client = new Client();

            var clientService = new ClientService();

            if (client == null)
            {
                client = new NullClient();
            }

            clientService.CreateClient(client);
        }
예제 #5
0
        public void XmlBuilder_CreateSlotDetail_PopulatesAnXsltStyleNumberFormat()
        {
            // Arrange
            var client = new NullClient {
                Settings = new ClientSettings()
            };
            var slot       = new SlotModel(client);
            var xmlBuilder = new XmlBuilder(client.Preferences);
            // Act
            var slotDetail = xmlBuilder.CreateSlotDetail(slot, DateTime.Now);

            // Assert
            Assert.AreEqual("###,###,##0.0", slotDetail.NumberFormat);
        }
예제 #6
0
        public void XmlBuilder_CreateSlotDetail_PopulatesUpdateDateTimeFromArgument()
        {
            // Arrange
            var client = new NullClient {
                Settings = new ClientSettings()
            };
            var slot           = new SlotModel(client);
            var updateDateTime = DateTime.Now;
            var xmlBuilder     = new XmlBuilder(client.Preferences);
            // Act
            var slotDetail = xmlBuilder.CreateSlotDetail(slot, updateDateTime);

            // Assert
            Assert.AreEqual(updateDateTime, slotDetail.UpdateDateTime);
        }
        public void ClientSettingsManager_Write_WritesTheClientSettingsToDisk()
        {
            // Arrange
            var client = new NullClient();

            client.Settings = new ClientSettings {
                Name = "test"
            };
            using (var artifacts = new ArtifactFolder())
            {
                var    manager = new ClientSettingsManager(null);
                string path    = Path.ChangeExtension(artifacts.GetRandomFilePath(), ".hfmx");
                // Act
                manager.Write(new[] { client.Settings }, path, 1);
                // Assert
                Assert.AreEqual(path, manager.FileName);
                Assert.AreEqual(1, manager.FilterIndex);
                Assert.AreEqual(".hfmx", manager.FileExtension);
            }
        }