public void AllSectionsUnspecified_ThrowsException() { var builder = new FrameBuilder() .AddFrame() .WithFrameLength(100) .WithRepeated(true); Assert.Throws<ArgumentException>(() => builder.Build()); }
public void FrameLengthUnspecified_ThrowsException() { var builder = new FrameBuilder() .AddFrame() .WithRepeated(true) .WithLightSection(lightSection) .WithFanSection(fanSection) .WithRumbleSection(rumbleSection); Assert.Throws<ArgumentException>(() => builder.Build()); }
public void FrameStatistics_RecordsSceneLength() { var lightSection = new LightSectionBuilder() .WithAllLights(arbitraryLight) .Build(); var frames = new FrameBuilder() .AddFrame() .WithFrameLength(1000) .WithRepeated(false) .WithLightSection(lightSection) .AddFrame() .WithFrameLength(500) .WithRepeated(false) .WithLightSection(lightSection) .Build(); var stats = new FrameStatistics(frames); Assert.AreEqual(frames.Sum(frame => frame.Length), stats.SceneLength); }
public void FrameStatistics_ContainsNoDuplicates() { var lightSection = new LightSectionBuilder() .WithAllLights(arbitraryLight) .Build(); var frames = new FrameBuilder() .AddFrame() .WithFrameLength(1000) .WithRepeated(false) .WithLightSection(lightSection) .AddFrame() .WithFrameLength(1000) .WithRepeated(false) .WithLightSection(lightSection) .Build(); var stats = new FrameStatistics(frames); Assert.AreEqual(8, stats.EnabledDirectionalComponents.Count); }
public void FrameStatistics_ContainsExpectedComponentType() { var lightSection = new LightSectionBuilder() .WithLightInDirection(eDirection.North, arbitraryLight) .Build(); var frames = new FrameBuilder() .AddFrame() .WithFrameLength(1000) .WithRepeated(false) .WithLightSection(lightSection) .Build(); var stats = new FrameStatistics(frames); Assert.IsTrue(stats.AreEnabledForComponent(eComponentType.Light)); Assert.IsFalse(stats.AreEnabledForComponent(eComponentType.Fan)); Assert.IsFalse(stats.AreEnabledForComponent(eComponentType.Rumble)); Assert.IsTrue(stats.AreEnabledForComponentAndDirection(new DirectionalComponent(eComponentType.Light, eDirection.North))); Assert.AreEqual(1, stats.EnabledDirectionalComponents.Count()); }
public void SpecifyingFrameDataBeforeAddingAFrame_ThrowsException() { var builder = new FrameBuilder(); Assert.Throws<NullReferenceException>(() => builder.WithFrameLength(100)); }
public void RepeatedAndFrameLengthAndOneSectionSpecified_Builds(AddSection addSection) { var builder = new FrameBuilder() .AddFrame() .WithFrameLength(100) .WithRepeated(true); addSection(builder); Assert.DoesNotThrow(() => builder.Build()); }
public void NewlyBuiltFrame_HasExpectedData() { var frame = new FrameBuilder() .AddFrameWithDefaults() .Build() .Single(); Assert.AreEqual(lightSection, frame.LightSection); Assert.AreEqual(fanSection, frame.FanSection); Assert.AreEqual(rumbleSection, frame.RumbleSection); }
public void MultipleFrames_AddedCorrectly() { var frames = new FrameBuilder() .AddFrameWithDefaults(200) .AddFrameWithDefaults(400) .Build(); Assert.AreEqual(2, frames.Count); Assert.AreEqual(200, frames[0].Length); Assert.AreEqual(400, frames[1].Length); }