public async Task InMemoryDataBase_Update_UpdatesCorrectComponent() { InMemoryDatabaseSubstitute substitute = CreateSubstitute(); HardwareComponent component = new HardwareComponent("#2", 50, 10, 200, "Core i9-9900K", "An overpriced processor", 1); await substitute.UpdateHardwareComponent(component); var getResultComponent = await substitute.GetHardwareComponent("#2"); Assert.AreEqual(component.componentName, getResultComponent.componentName); }
public async Task InMemoryDataBase_GetHardwareComponent_ReturnsCorrectComponent() { InMemoryDatabaseSubstitute substitute = CreateSubstitute(); var value = await substitute.GetHardwareComponent("#2"); Assert.AreEqual(value.componentUid, "#2"); Assert.AreEqual(value.componentAmount, 3); Assert.AreEqual(value.componentDrawer, 2); Assert.AreEqual(value.componentName, "TEST"); Assert.AreEqual(value.componentNotes, "10/10 would recommend"); Assert.AreEqual(value.componentOrderWarning, 20); Assert.AreEqual(value.componentRack, 4); }
public async Task InMemoryDataBase_AddHardwareComponent_AddsCorrectComponent() { InMemoryDatabaseSubstitute substitute = CreateSubstitute(); await substitute.AddComponent(new HardwareComponent("#3", 50, 10, 200, "Core i9-9900K", "An overpriced processor", 1)); var value = await substitute.GetHardwareComponent("#3"); Assert.AreEqual(value.componentUid, "#3"); Assert.AreEqual(value.componentAmount, 50); Assert.AreEqual(value.componentDrawer, 200); Assert.AreEqual(value.componentName, "Core i9-9900K"); Assert.AreEqual(value.componentNotes, "An overpriced processor"); Assert.AreEqual(value.componentOrderWarning, 1); Assert.AreEqual(value.componentRack, 10); }
public async Task InMemoryDataBase_GetHardwareComponents_ReturnsComponents() { InMemoryDatabaseSubstitute substitute = CreateSubstitute(); var values = await substitute.GetHardwareComponents(); foreach (KeyValuePair <string, HardwareComponent> componentPair in values) { Assert.AreEqual(componentPair.Key, "#2"); Assert.AreEqual(componentPair.Value.componentAmount, 3); Assert.AreEqual(componentPair.Value.componentDrawer, 2); Assert.AreEqual(componentPair.Value.componentName, "TEST"); Assert.AreEqual(componentPair.Value.componentNotes, "10/10 would recommend"); Assert.AreEqual(componentPair.Value.componentOrderWarning, 20); Assert.AreEqual(componentPair.Value.componentRack, 4); Assert.AreEqual(componentPair.Value.componentUid, "#2"); } }
public void InMemoryDataBase_ConstructorCalled_DoesNotCrash() { Assert.DoesNotThrow(() => { InMemoryDatabaseSubstitute inMemoryDatabase = new InMemoryDatabaseSubstitute(); }); }
public async Task SetUp() { databaseSubstitute = new InMemoryDatabaseSubstitute(); await databaseSubstitute.AddComponent(new HardwareComponent("#4", 5, 2, 3, "A", "Z")); }