Exemplo n.º 1
0
 private InputBoolean CreateTestEntry(out string entityId, out string name, out string icon, out bool initial)
 {
     entityId = MockHelpers.GetRandomEntityId(KnownDomains.InputBoolean);
     name     = MockHelpers.GetRandomTestName();
     icon     = "mdi:fan";
     initial  = true;
     return(InputBoolean.CreateUnmodified(entityId, name, icon, initial));
 }
Exemplo n.º 2
0
        protected override async Task OneTimeSetUp()
        {
            await base.OneTimeSetUp();

            this.testInputBoolean = new InputBoolean(MockHelpers.GetRandomTestName(), "mdi:switch");
            var result = await this.hassWSApi.CreateStorageEntityRegistryEntryAsync(this.testInputBoolean);

            this.testEntityId = this.testInputBoolean.EntityId;

            Assert.IsTrue(result, "SetUp failed");
        }
Exemplo n.º 3
0
        public async Task DeleteInputBoolean()
        {
            if (this.testInputBoolean == null)
            {
                return;
            }

            var result = await this.hassWSApi.DeleteStorageEntityRegistryEntryAsync(this.testInputBoolean);

            var deletedInputBoolean = this.testInputBoolean;

            this.testInputBoolean = null;

            Assert.IsTrue(result);
            Assert.IsFalse(deletedInputBoolean.IsTracked);
        }
Exemplo n.º 4
0
        public async Task CreateInputBoolean()
        {
            if (this.testInputBoolean == null)
            {
                this.testInputBoolean = new InputBoolean(MockHelpers.GetRandomTestName(), "mdi:fan", true);
                var result = await this.hassWSApi.CreateStorageEntityRegistryEntryAsync(this.testInputBoolean);

                Assert.IsTrue(result, "SetUp failed");
                return;
            }

            Assert.NotNull(this.testInputBoolean);
            Assert.NotNull(this.testInputBoolean.UniqueId);
            Assert.NotNull(this.testInputBoolean.Name);
            Assert.IsFalse(this.testInputBoolean.HasPendingChanges);
            Assert.IsTrue(this.testInputBoolean.IsTracked);
        }
Exemplo n.º 5
0
        public void NewInputBooleanIsUntracked()
        {
            var testEntry = new InputBoolean(MockHelpers.GetRandomTestName());

            Assert.False(testEntry.IsTracked);
        }
Exemplo n.º 6
0
        public void NewInputBooleanHasPendingChanges()
        {
            var testEntry = new InputBoolean(MockHelpers.GetRandomTestName());

            Assert.IsTrue(testEntry.HasPendingChanges);
        }